Skip to content

[flags] Sign precompute codes with VERCEL_PROJECT_KEY when Vercel provides it - #661

Draft
luismeyer wants to merge 2 commits into
mainfrom
luismeyer/vercel-project-key
Draft

luismeyer wants to merge 2 commits into
mainfrom
luismeyer/vercel-project-key

Conversation

@luismeyer

@luismeyer luismeyer commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Why

  • Without a user secret, precompute signs its codes with a key derived from VERCEL_DEPLOYMENT_KEY, which is random per deployment. The codes, and the build output that embeds them, therefore differ in every deployment even when nothing else changed.
  • That prevents build output from being reused between deployments, and a restored build cache (Turborepo) replays codes that are no longer valid.
  • Vercel is adding VERCEL_PROJECT_KEY, a key that is the same for every deployment of a project. This makes precompute prefer it.

What changes

  • The Vercel-provided secret is derived from VERCEL_PROJECT_KEY when it is set, otherwise from VERCEL_DEPLOYMENT_KEY as before. The derivation is unchanged, so projects without the new variable produce the same codes as today.
  • A passed secret, FLAGS_SECRET and FLAGS_PRECOMPUTE_SECRET still win.
  • Docs and the Turborepo guidance are updated.

Notes for review

  • VERCEL_PROJECT_KEY is not available to projects yet; this should not be released before the platform side ships.
  • With the project key, a code created in one deployment (including a preview) is valid in every deployment of the project.
  • Turborepo: the docs tell users to list both keys in the task's env, which is always correct, and to drop VERCEL_DEPLOYMENT_KEY only when every build of the task has VERCEL_PROJECT_KEY. Until then the deployment key changes the hash on every deployment and nothing is restored from the cache.
  • The docs name flags 4.7.0 as the first version that reads VERCEL_PROJECT_KEY (current 4.6.0 plus this minor). Adjust if another release lands first.

🤖 Generated with Claude Code

…vides it

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

vercel Bot commented Nov 30, 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 30, 2026 5:29pm UTC
flags-sdk-dev Ready Ready Preview, v0 Nov 30, 2026 5:29pm UTC
flags-sdk-flagsmith Ready Ready Preview, v0 Nov 30, 2026 5:29pm UTC
flags-sdk-growthbook Ready Ready Preview, v0 Nov 30, 2026 5:29pm UTC
flags-sdk-launchdarkly Ready Ready Preview, v0 Nov 30, 2026 5:29pm UTC
flags-sdk-openfeature Ready Ready Preview, v0 Nov 30, 2026 5:29pm UTC
flags-sdk-posthog Ready Ready Preview, v0 Nov 30, 2026 5:29pm UTC
flags-sdk-reflag Ready Ready Preview, v0 Nov 30, 2026 5:29pm UTC
flags-sdk-snippets Ready Ready Preview, v0 Nov 30, 2026 5:29pm UTC
flags-sdk-statsig Ready Ready Preview, v0 Nov 30, 2026 5:29pm UTC
flags-sdk-sveltekit-snippets Ready Ready Preview, v0 Nov 30, 2026 5:29pm UTC
shirt-shop Ready Ready Preview, v0 Nov 30, 2026 5:29pm UTC
shirt-shop-api Ready Ready Preview, v0 Nov 30, 2026 5:29pm UTC

…Turborepo advice safe

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

This branch was successfully deployed

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