Uh oh!
There was an error while loading. Please reload this page.
fix(astro): Restore Cloudflare Pages compatibility broken by cloudflare:workers env - #8136
Conversation
🦋 Changeset detectedLatest commit: eec0c0f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
@mlafeldt is attempting to deploy a commit to the Clerk Production Team on Vercel. A member of the Team first needs to authorize it. |
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis pull request adds a Cloudflare Pages environment variable resolution fix to the 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…re:workers env On Cloudflare Pages (Astro v5), `cloudflare:workers` env may be available but lack dashboard secrets (CLERK_SECRET_KEY, etc.) that are only present in the fetch handler's env param (locals.runtime.env). The current code short-circuits on cloudflareEnv without checking whether the requested key actually exists, preventing the fallback chain from ever reaching locals.runtime.env. This causes all SSR pages to break with `[object Object]` responses. Fix: check if the value is defined before returning from the cloudflareEnv branch, allowing the fallback to locals.runtime.env.
f093e77 to
eec0c0fCompareThe latest updates on your projects. Learn more about Vercel for GitHub.
|
Uh oh!
There was an error while loading. Please reload this page.
Add initCloudflareWorkersEnv() and cloudflare:workers module env check to the shared getEnvVariable() function. This allows Clerk to read environment variables directly from the Cloudflare Workers runtime, following the same pattern used in @clerk/astro (PRs clerk#7889, clerk#8136). Needed for TanStack Start, Hono, and other frameworks on CF Workers where process.env and import.meta.env are not available at runtime.
On Cloudflare Pages (Astro v5),
cloudflare:workersenv may be available but lack dashboard secrets (CLERK_SECRET_KEY, etc.) that are only present in the fetch handler's env param (locals.runtime.env).The current code short-circuits on cloudflareEnv without checking whether the requested key actually exists, preventing the fallback chain from ever reaching
locals.runtime.env. This causes all SSR pages to break with[object Object]responses.Fix: check if the value is defined before returning from the cloudflareEnv branch, allowing the fallback to locals.runtime.env.
Follow-up fix to #7890
Description
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit