Repository navigation
docs: declare Flags SDK variables in src/env.ts on SvelteKit 3 - #603
Merged
Merged
Conversation
…it 3 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documents the one extra setup step that SvelteKit 3 needs for the Flags SDK to work locally without a
FLAGS_SECRET.Why
SvelteKit 3 only exposes the environment variables that
src/env.tsdeclares.$env/static/privateand$env/dynamic/privateare deprecated shims over$app/env/private, and Vite does not add.env.localtoprocess.env. So the SDK does not see theVERCEL_OIDC_TOKENthatvercel env pullwrites, and does not recognise local development of a Vercel project:precomputeandgeneratePermutationsthrowflags: precompute has no secretinvite devand in a localvite build, instead of using the public development secret.FLAGS_SECRETorFLAGS_PRECOMPUTE_SECRETthat is only in.env.localis not read either.A deployment on Vercel is not affected, because the variables are in
process.envthere.Changes
frameworks/sveltekit/index.mdx: a new setup step that declaresVERCEL_OIDC_TOKENinsrc/env.tswith an optional schema, and a note thatFLAGS_SECRETmust be declared on SvelteKit 3.skills/flags-sdk/references/sveltekit.md: the same step.Validation
Tested with a SvelteKit 3.2 app and a build of
flagsfrom the #596 branch (74a95746), with noFLAGS_SECRET:/pricing(precomputed) fails invite devandvite buildfails while prerendering.FLAGS_SECRETonly in.env.local, a local build fails untilFLAGS_SECRETis declared.I did not build the docs site, and I did not test
FLAGS_PRECOMPUTE_SECRETor SvelteKit 2.🤖 Generated with Claude Code