Skip to content

docs: declare Flags SDK variables in src/env.ts on SvelteKit 3 - #603

Merged
luismeyer merged 1 commit into
docs/optional-flags-secretfrom
docs/sveltekit-3-env
Nov 17, 2026
Merged

luismeyer merged 1 commit into
docs/optional-flags-secretfrom
docs/sveltekit-3-env

Conversation

@luismeyer

Copy link
Copy Markdown
Member

Documents the one extra setup step that SvelteKit 3 needs for the Flags SDK to work locally without a FLAGS_SECRET.

Stacked on #596.

Why

SvelteKit 3 only exposes the environment variables that src/env.ts declares. $env/static/private and $env/dynamic/private are deprecated shims over $app/env/private, and Vite does not add .env.local to process.env. So the SDK does not see the VERCEL_OIDC_TOKEN that vercel env pull writes, and does not recognise local development of a Vercel project:

  • precompute and generatePermutations throw flags: precompute has no secret in vite dev and in a local vite build, instead of using the public development secret.
  • A FLAGS_SECRET or FLAGS_PRECOMPUTE_SECRET that is only in .env.local is not read either.

A deployment on Vercel is not affected, because the variables are in process.env there.

Changes

  • frameworks/sveltekit/index.mdx: a new setup step that declares VERCEL_OIDC_TOKEN in src/env.ts with an optional schema, and a note that FLAGS_SECRET must 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 flags from the #596 branch (74a95746), with no FLAGS_SECRET:

  • Without the declaration, /pricing (precomputed) fails in vite dev and vite build fails while prerendering.
  • With the declaration, both work and use the public development secret.
  • With FLAGS_SECRET only in .env.local, a local build fails until FLAGS_SECRET is declared.
  • A deployment on Vercel with the declaration still works.

I did not build the docs site, and I did not test FLAGS_PRECOMPUTE_SECRET or SvelteKit 2.

🤖 Generated with Claude Code

…it 3

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
flags-playground Ready Ready Preview, v0 Nov 17, 2026 10:13am UTC
flags-sdk-dev Ready Ready Preview, v0 Nov 17, 2026 10:13am UTC
flags-sdk-flagsmith Ready Ready Preview, v0 Nov 17, 2026 10:13am UTC
flags-sdk-growthbook Ready Ready Preview, v0 Nov 17, 2026 10:13am UTC
flags-sdk-launchdarkly Ready Ready Preview, v0 Nov 17, 2026 10:13am UTC
flags-sdk-openfeature Ready Ready Preview, v0 Nov 17, 2026 10:13am UTC
flags-sdk-posthog Ready Ready Preview, v0 Nov 17, 2026 10:13am UTC
flags-sdk-reflag Ready Ready Preview, v0 Nov 17, 2026 10:13am UTC
flags-sdk-snippets Ready Ready Preview, v0 Nov 17, 2026 10:13am UTC
flags-sdk-statsig Ready Ready Preview, v0 Nov 17, 2026 10:13am UTC
flags-sdk-sveltekit-snippets Ready Ready Preview, v0 Nov 17, 2026 10:13am UTC
shirt-shop Ready Ready Preview, v0 Nov 17, 2026 10:13am UTC
shirt-shop-api Ready Ready Preview, v0 Nov 17, 2026 10:13am UTC

@luismeyer
luismeyer merged commit 5ba8a25 into docs/optional-flags-secret Nov 17, 2026
20 checks passed
@luismeyer
luismeyer deleted the docs/sveltekit-3-env branch November 17, 2026 10:15

This branch was successfully deployed

14 active deployments
Preview – flags-sdk-dev — 42c5332e Deployed Nov 17, 2026 by vercel[bot]
Preview – flags-sdk-sveltekit-snippets — 42c5332e Deployed Nov 17, 2026 by vercel[bot]
Preview – shirt-shop — 42c5332e Deployed Nov 17, 2026 by vercel[bot]
Preview – flags-sdk-openfeature — 42c5332e Deployed Nov 17, 2026 by vercel[bot]
Preview – flags-sdk-vercel — 42c5332e Deployed Nov 17, 2026 by vercel[bot]
Preview – flags-playground — 42c5332e Deployed Nov 17, 2026 by vercel[bot]
Preview – flags-sdk-snippets — 42c5332e Deployed Nov 17, 2026 by vercel[bot]
Preview – flags-sdk-flagsmith — 42c5332e Deployed Nov 17, 2026 by vercel[bot]
Preview – flags-sdk-reflag — 42c5332e Deployed Nov 17, 2026 by vercel[bot]
Preview – flags-sdk-statsig — 42c5332e Deployed Nov 17, 2026 by vercel[bot]
Preview – flags-sdk-posthog — 42c5332e Deployed Nov 17, 2026 by vercel[bot]
Preview – flags-sdk-launchdarkly — 42c5332e Deployed Nov 17, 2026 by vercel[bot]
Preview – flags-sdk-growthbook — 42c5332e Deployed Nov 17, 2026 by vercel[bot]
Preview – shirt-shop-api — 42c5332e Deployed Nov 17, 2026 by vercel[bot]
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.

1 participant