Uh oh!
There was an error while loading. Please reload this page.
fix(tanstack-start): Fix environment variable loading in runtime contexts - #4743
Conversation
🦋 Changeset detectedLatest commit: 6685212 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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
octoper
commented
Dec 10, 2024
!snapshot |
clerk-cookie
commented
Dec 10, 2024
Hey @octoper - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/astro@2.0.1-snapshot.v20241210001110 --save-exact
npm i @clerk/backend@1.20.3-snapshot.v20241210001110 --save-exact
npm i @clerk/chrome-extension@2.0.9-snapshot.v20241210001110 --save-exact
npm i @clerk/clerk-js@5.40.3-snapshot.v20241210001110 --save-exact
npm i @clerk/elements@0.21.4-snapshot.v20241210001110 --save-exact
npm i @clerk/clerk-expo@2.4.5-snapshot.v20241210001110 --save-exact
npm i @clerk/expo-passkeys@0.0.17-snapshot.v20241210001110 --save-exact
npm i @clerk/express@1.3.26-snapshot.v20241210001110 --save-exact
npm i @clerk/fastify@2.0.28-snapshot.v20241210001110 --save-exact
npm i @clerk/localizations@3.8.2-snapshot.v20241210001110 --save-exact
npm i @clerk/nextjs@6.8.3-snapshot.v20241210001110 --save-exact
npm i @clerk/nuxt@0.0.13-snapshot.v20241210001110 --save-exact
npm i @clerk/clerk-react@5.19.3-snapshot.v20241210001110 --save-exact
npm i @clerk/react-router@0.0.2-snapshot.v20241210001110 --save-exact
npm i @clerk/remix@4.3.6-snapshot.v20241210001110 --save-exact
npm i @clerk/clerk-sdk-node@5.0.77-snapshot.v20241210001110 --save-exact
npm i @clerk/shared@2.19.4-snapshot.v20241210001110 --save-exact
npm i @clerk/tanstack-start@0.7.0-snapshot.v20241210001110 --save-exact
npm i @clerk/testing@1.3.38-snapshot.v20241210001110 --save-exact
npm i @clerk/themes@2.1.55-snapshot.v20241210001110 --save-exact
npm i @clerk/types@4.39.2-snapshot.v20241210001110 --save-exact
npm i @clerk/ui@0.2.4-snapshot.v20241210001110 --save-exact
npm i @clerk/vue@0.0.17-snapshot.v20241210001110 --save-exact |
wobsoriano
commented
Jan 15, 2025
!snapshot |
clerk-cookie
commented
Jan 15, 2025
Hey @wobsoriano - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/astro@2.1.8-snapshot.v20250115000107 --save-exact
npm i @clerk/backend@1.22.1-snapshot.v20250115000107 --save-exact
npm i @clerk/chrome-extension@2.1.12-snapshot.v20250115000107 --save-exact
npm i @clerk/clerk-js@5.44.1-snapshot.v20250115000107 --save-exact
npm i @clerk/clerk-expo@2.6.11-snapshot.v20250115000107 --save-exact
npm i @clerk/express@1.3.35-snapshot.v20250115000107 --save-exact
npm i @clerk/fastify@2.1.8-snapshot.v20250115000107 --save-exact
npm i @clerk/nextjs@6.9.11-snapshot.v20250115000107 --save-exact
npm i @clerk/nuxt@1.0.4-snapshot.v20250115000107 --save-exact
npm i @clerk/react-router@0.1.9-snapshot.v20250115000107 --save-exact
npm i @clerk/remix@4.4.10-snapshot.v20250115000107 --save-exact
npm i @clerk/tanstack-start@0.8.9-snapshot.v20250115000107 --save-exact
npm i @clerk/testing@1.4.8-snapshot.v20250115000107 --save-exact
npm i @clerk/vue@1.0.3-snapshot.v20250115000107 --save-exact |
| // Cloudflare context check | ||
| const cfValue = event?.context?.cloudflare?.env[name]; | ||
| if (cfValue) { | ||
| return cfValue; | ||
| } |
There was a problem hiding this comment.
Nitro injects the runtime env vars to the H3 event context. For Cloudflare, the property is event.context.cloudflare.
We pass this event object in a request lifecycle to make runtime env vars available
I answered the same question here.
…exts (#4743) Co-authored-by: Robert Soriano <sorianorobertc@gmail.com>
Description
The PR fixes an issue where environment variables are accessed global contexts, which doesn't work in runtimes like Cloudflare that only make them available during the request lifecycle.
Nitro environment variables guideline
Resolves ECO-288 and ECO-274
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change