close
Skip to content

fix(shared): guard auto-proxy env lookup#8466

Open
jacekradko wants to merge 4 commits intomainfrom
jacek/fix-cloudflare-process-proxy
Open

fix(shared): guard auto-proxy env lookup#8466
jacekradko wants to merge 4 commits intomainfrom
jacek/fix-cloudflare-process-proxy

Conversation

@jacekradko
Copy link
Copy Markdown
Member

Summary

Fixes #8459 by avoiding an unconditional process.env default parameter in shared auto-proxy detection. Worker-style runtimes without process now fall back to an empty environment instead of throwing before the function body runs.

Changes

  • Add a guarded default environment helper for getAutoProxyUrlFromEnvironment.
  • Add a regression test that deletes globalThis.process while calling auto-proxy detection.
  • Add a patch changeset for @clerk/shared.

Testing

  • pnpm --filter @clerk/shared exec vitest run src/__tests__/proxy.spec.ts

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

🦋 Changeset detected

Latest commit: d6456fa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
Name Type
@clerk/shared Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/chrome-extension Patch
@clerk/clerk-js Patch
@clerk/expo-passkeys Patch
@clerk/expo Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/hono Patch
@clerk/localizations Patch
@clerk/msw Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/react Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/ui Patch
@clerk/vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment May 5, 2026 0:53am

Request Review

@jacekradko jacekradko changed the title fix: guard auto-proxy env lookup fix(shared): guard auto-proxy env lookup May 4, 2026
@jacekradko jacekradko marked this pull request as ready for review May 4, 2026 17:41
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 7ad48c33-09c1-4b93-8424-3b185df76985

📥 Commits

Reviewing files that changed from the base of the PR and between 7ea8a0b and 53b7ee1.

📒 Files selected for processing (3)
  • .changeset/fix-cloudflare-process-proxy.md
  • packages/shared/src/__tests__/proxy.spec.ts
  • packages/shared/src/proxy.ts

📝 Walkthrough

Walkthrough

The pull request adds a getDefaultEnvironment() helper function that safely accesses process.env when available, returning an empty object otherwise. The getAutoProxyUrlFromEnvironment function's environment parameter default is updated to use this helper instead of directly referencing process.env. A test case was added to verify the function handles environments where process is unavailable. These changes are documented in a changeset entry for a patch version bump to @clerk/shared.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: guarding auto-proxy environment lookup to prevent errors in environments without process.
Description check ✅ Passed The description is well-related to the changeset, explaining the fix for issue #8459 with detailed changes and testing instructions.
Linked Issues check ✅ Passed The PR directly addresses issue #8459 by implementing guarded access to process.env through a helper function and adding regression tests.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the process.env guard issue: the helper function, test coverage, and changeset entry are all in-scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Review rate limit: 4/5 reviews remaining, refill in 12 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 4, 2026

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8466

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8466

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8466

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8466

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@8466

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@8466

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8466

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8466

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8466

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8466

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8466

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8466

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8466

@clerk/react

npm i https://pkg.pr.new/@clerk/react@8466

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8466

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8466

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@8466

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8466

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8466

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8466

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8466

commit: d6456fa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

process is undefined in @clerk/shared in cloudflare workers

2 participants