Ryan KatayiSenior full-stack engineer
    All sessions

    Engineering notes — ExplainersUsing Vercel Flags SDK without FLAGS_SECRET

    How to migrate to Vercel Flags SDK 4.5.0 on Vercel without FLAGS_SECRET, clean up env vars, and handle precompute safely in multi-repo setups.

    9 min

    #Vercel#Next.js#Infrastructure

    Vercel’s latest Flags SDK release, flags@4.5.0, removes the need for FLAGS_SECRET for projects deployed on Vercel when you’re using Flags Explorer and precompute. You can now rely on Vercel-managed signing and encryption instead of keeping a shared secret in sync across repos.

    This post walks through how that works, what actually changes in your config, how precompute behaves with and without a secret, and a step-by-step migration you can do in under an hour without breaking existing flags. If you care about keeping your Vercel setup predictable, you might also find my write-up on usage-based Standard builds billing useful.

    What changed in flags@4.5.0

    From Vercel’s changelog:

    "With flags@4.5.0, projects on Vercel can use Flags Explorer and precompute without FLAGS_SECRET. That cuts out a setup step for new projects and removes the need to keep a shared secret in sync across microfrontends."

    — Vercel changelog, 2026-11-24

    The important parts:

    1. New projects on Vercel don’t need FLAGS_SECRET for:

      • Flags Explorer
      • Precompute
    2. Vercel now handles trust for you:

      • Vercel signs Flags Explorer discovery requests and overrides.
      • The Flags SDK encrypts flag values shown in the Vercel Toolbar with Vercel’s public key.
    3. Existing projects keep their current behavior:

      • If FLAGS_SECRET is set as an environment variable, or you pass a secret in code, the project continues using that secret.
      • Upgrading to flags@4.5.0 alone does not change how your flags work.

    To move an existing project to Vercel-managed keys you have to remove the environment variable and any explicit secret in code.

    If your app runs on Vercel, this means one less piece of config to manage and one less shared secret to keep in sync across microfrontends.

    How Vercel Flags works without FLAGS_SECRET

    Vercel outlines two core mechanisms in the announcement: signed requests and encrypted toolbar values. Here is how they fit together in practice.

    1. Flags Explorer discovery and overrides are signed by Vercel

    When your app uses Flags Explorer on Vercel, the discovery calls and any override actions used for debugging are now signed by Vercel itself instead of by your own FLAGS_SECRET.

    Conceptually, you can think of it like this:

    [Flags Explorer] -> signed request -> [Your app on Vercel]

    Before flags@4.5.0 you had to prove that these requests were legitimate using a shared secret. Now Vercel plays that role by signing requests at the platform level.

    1. Toolbar values are encrypted with Vercel’s public key

    Vercel writes:

    "Vercel signs Flags Explorer discovery requests and overrides, and the SDK encrypts flag values shown in the Vercel Toolbar with Vercel’s public key."

    — Vercel changelog, 2026-11-24

    The Flags SDK now uses Vercel’s public key to encrypt the values it shows in the Vercel Toolbar. That replaces the need for your own shared secret when debugging feature flags from the toolbar.

    1. Existing projects stay on secrets until you remove them

    The SDK doesn’t auto-migrate existing deployments. It checks whether:

    • FLAGS_SECRET is present as an environment variable, or
    • you pass a secret directly in code.

    If either is true, it keeps using the secret-based behavior you already have. It only switches to the Vercel-managed keys once the secret is removed from both env vars and code.

    For local development, Vercel recommends:

    • "For local development, run vercel env pull."

    That keeps your local environment in sync with whatever you’ve configured in the Vercel dashboard.

    Before vs after: env and config cleanup

    There is no breaking change as long as you don’t touch your secrets. The migration is you choosing to remove the secret, not the SDK changing under you.

    Here is an illustrative example of how your environment variables might look before and after.

    Before (secret-based setup)

    # .env / Vercel project env
    FLAGS_SECRET=<shared-flags-secret>
    FLAGS_PRECOMPUTE_SECRET=<optional-precompute-secret>

    In this model:

    • FLAGS_SECRET is used for Flags Explorer and toolbar-related behavior.
    • FLAGS_PRECOMPUTE_SECRET is only needed if you chose to separate the secret for precompute.

    After (Vercel-managed keys on Vercel)

    Once you’re on flags@4.5.0 and remove your secret, your env can look like this:

    # .env / Vercel project env
    # FLAGS_SECRET removed
    # FLAGS_PRECOMPUTE_SECRET optional, only if you need cross-deployment precompute

    You don’t add a replacement variable. The SDK automatically falls back to Vercel-managed keys when no secret is present.

    If you still need precompute to work across deployments or builds, you can keep just FLAGS_PRECOMPUTE_SECRET and leave FLAGS_SECRET undefined. Vercel explains:

    "Prebuilt deployments and codes that must work across deployments still need a secret; use FLAGS_PRECOMPUTE_SECRET if only precompute needs one."

    That gives you a tighter scope, especially in multi-repo setups.

    How precompute works now (and when you still need a secret)

    Precompute is the one area where behavior changes depending on whether you use a secret.

    Vercel gives three clear rules in the announcement.

    1. Precompute without a secret is deployment-bound

    "Precomputed codes created without a secret work only in the deployment that created them."

    If you don’t configure any secret, the codes you precompute are tied to the deployment that produced them. That is good for safety and avoids cross-deployment leakage, but it means you can’t expect a code created on one deployment to function in another.

    1. Precompute without a secret needs Vercel system env vars

    "Precompute without a secret requires Vercel system environment variables, which are enabled by default."

    On Vercel, system environment variables are already on by default, so for most projects there’s nothing to change. If those were disabled intentionally, precompute without a secret won’t work until they’re re-enabled.

    1. Cross-deployment or prebuilt flows still need a secret

    "Prebuilt deployments and codes that must work across deployments still need a secret; use FLAGS_PRECOMPUTE_SECRET if only precompute needs one. If you use a build cache, see the precompute documentation for the required configuration."

    Two implications:

    • If you generate precomputed codes in a prebuild step, or they must work across deployments, you keep using a secret.
    • You can tighten scope using FLAGS_PRECOMPUTE_SECRET while dropping FLAGS_SECRET for Explorer and toolbar.

    The build cache detail is only mentioned at a high level in the changelog, so I’d read the precompute documentation before changing secrets in any project with non-trivial caching to avoid stale or invalid codes.

    Step-by-step migration for a multi-repo or microfrontend setup

    For a multi-repo or microfrontend setup on Vercel, the main benefit is dropping the shared secret you previously had to keep in sync.

    Here is a concrete migration path you can use as a checklist.

    1. Upgrade to flags@4.5.0

    Upgrade your Flags SDK in each repo that uses it.

    # example
    npm install flags@4.5.0

    Use whatever package manager you already use. The key is that every microfrontend that relies on Vercel Flags should be on the same major behavior.

    If you are also moving other platform integrations forward, my walkthrough of a Vercel Drives migration shows the same pattern of incremental, tested changes.

    2. Confirm you’re actually on Vercel for the affected projects

    The new behavior applies to projects on Vercel. If any part of your system runs outside Vercel, treat that part as still needing the old secret contract unless your own setup says otherwise.

    3. Identify where FLAGS_SECRET is set

    In each repo and Vercel project:

    1. Open the Vercel dashboard.
    2. Go to the project.
    3. Open Settings → Environment Variables.
    4. Look for FLAGS_SECRET.

    Also search the codebase for FLAGS_SECRET or any explicit secret passed to the Flags SDK. For example:

    // Illustrative example, adjust to your actual API
    const flagsClient = createFlagsClient({
      // Remove this when migrating
      secret: process.env.FLAGS_SECRET,
    });

    If you see anything like this, you’ll need to remove it as part of the switch.

    4. Decide your precompute strategy per project

    For each Vercel project using Flags precompute, choose one of two modes:

    1. Deployment-bound precompute without secrets

      • You accept that precomputed codes only work in the deployment that created them.
      • You’re not relying on prebuilt deployments or cross-deployment codes.
      • You’ll rely on Vercel system environment variables instead of a secret.
    2. Cross-deployment or prebuilt precompute with a secret

      • You keep or introduce FLAGS_PRECOMPUTE_SECRET.
      • You can remove FLAGS_SECRET to reduce surface area if you only need the secret for precompute.

    This is where the microfrontend simplification happens. Instead of one shared FLAGS_SECRET copied to every repo, each project holds just the configuration it needs.

    5. Remove FLAGS_SECRET from Vercel and code

    For every project where you want to use Vercel-managed keys:

    1. In the Vercel dashboard, delete the FLAGS_SECRET environment variable from all environments (Production, Preview, Development) where it’s set.
    2. In your code, remove any explicit secret parameters you pass into the Flags SDK.

    Your flags behavior will now switch to:

    • Vercel signing Flags Explorer discovery and overrides.
    • SDK encrypting toolbar values with Vercel’s public key.

    Existing flags and evaluations continue to work because the semantics of the flags themselves are not changed by this step.

    6. Update local development with vercel env pull

    Vercel recommends updating local environments using the CLI:

    vercel env pull

    That pulls your Vercel project’s environment variables into a local file, so your local .env matches whatever you configured after removing FLAGS_SECRET and adjusting any FLAGS_PRECOMPUTE_SECRET usage.

    If you have multiple repos, run this once per Vercel project from the root of each repo that maps to that project.

    7. Smoke test Flags Explorer and precompute

    Once secrets are cleaned up:

    • Use Flags Explorer on a new deployment and verify that discovery and overrides work.
    • If you use precompute without a secret, check that the codes work in the deployment that created them.
    • If you use FLAGS_PRECOMPUTE_SECRET, test your prebuilt or cross-deployment flows.

    This can usually fit into a single release cycle, especially if you stage the change per project.

    When I wouldn’t remove FLAGS_SECRET yet

    There are a few situations where I’d pause before removing your existing secret-based setup.

    • You rely heavily on prebuilt deployments and cross-deployment precompute codes. Vercel is explicit that these still need a secret. This doesn’t stop you from dropping FLAGS_SECRET, but you should be clear on how FLAGS_PRECOMPUTE_SECRET is configured.
    • You have a complex build cache strategy. Vercel says that if you use a build cache, you should check the precompute documentation for the required configuration. I’d line that up before touching secrets.
    • Part of your feature flag usage runs outside Vercel. The flags@4.5.0 change is specifically about projects on Vercel. If you’re running the same code elsewhere, you’ll need a plan for that environment.

    If any of those apply, cleanly separating FLAGS_PRECOMPUTE_SECRET and FLAGS_SECRET may be a better first step than removing secrets entirely.

    What this simplifies for small teams

    For a typical Vercel app, this change removes one secret, one sync problem and one class of misconfigurations. You no longer need to pass a secret into the Flags SDK just to use Flags Explorer or the Vercel Toolbar, and multi-repo setups don’t have to keep a shared FLAGS_SECRET in sync.

    The main piece to think about is precompute. Decide whether your codes must work across deployments or prebuilds and configure FLAGS_PRECOMPUTE_SECRET only where that’s true. Then remove FLAGS_SECRET, pull envs locally with vercel env pull, and you’re done.

    If you want a second set of eyes on a Vercel migration like this, especially in a Next.js codebase with multiple environments, I take on that kind of work as a Next.js developer.

    Sources

    Now playingCudioGet in touch