[KongchangAI]
· 2 min read· 1,068 words

Flags SDK 4.5.0: Vercel Projects Can Now Run Without FLAGS_SECRET

Flags SDK 4.5.0: Vercel Projects Can Now Run Without FLAGS_SECRET

Vercel Flags SDK 4.5.0 removes the FLAGS_SECRET requirement, with the platform managing key signing and encryption.

Vercel released Flags SDK 4.5.0, eliminating the need for the `FLAGS_SECRET` environment variable when using Flags Explorer and precompute on the Vercel platform. Vercel now signs Explorer discovery requests and overrides, and the SDK uses Vercel's public key to encrypt toolbar flag values, reducing setup complexity. Existing projects must remove the env var and explicit secrets in code, then run `vercel env pull` to migrate. Secret-less precompute codes only work in their creating deployment; cross-deployment or prebuilt deployments still need a secret, available via `FLAGS_PRECOMPUTE_SECRET`. Micro-frontend teams benefit most, with lower risk of key leakage and desync.

Vercel recently released Flags SDK version 4.5.0, bringing a significant simplification for projects on the Vercel platform: configuring the FLAGS_SECRET environment variable is no longer required to use Flags Explorer and precompute functionality. This change aims to reduce setup complexity for new projects and solve the challenge of synchronizing shared secrets in micro-frontend architectures.

Flags SDK 4.5.0 released

Farewell to Shared Secrets: Vercel-Managed Key Mechanism

According to the official documentation, in version 4.5.0, Vercel takes responsibility for signing Flags Explorer discovery requests and overrides, while the SDK uses Vercel's public key to encrypt the flag values displayed in the toolbar. This means developers no longer need to manually generate and safeguard FLAGS_SECRET—especially for new projects, eliminating one configuration step.

For existing projects, upgrading the SDK alone does not automatically switch to the Vercel-managed key mode. As long as the FLAGS_SECRET environment variable still exists, or a secret is explicitly passed in code, the project will continue using the original secret. To enable the new mechanism, you need to remove the environment variable and any code that explicitly passes a secret, then run vercel env pull during local development to sync environment variables.

On the signing mechanism for discovery requests and overrides: Flags Explorer is a visual panel in the Vercel toolbar used to view and temporarily override feature flag values at runtime. "Discovery requests" refer to calls the Explorer makes to endpoints like /api/flags to retrieve all flag definitions and values for the current project; "overrides" are flag values manually modified by developers through the toolbar, which must be sent back to the application to take effect. In older versions, both interactions had to be HMAC-signed with FLAGS_SECRET, and the server would verify the signature before trusting the request source, preventing arbitrary users from tampering with flags. After 4.5.0, the Vercel platform manages this signing key pair: requests are signed on the Vercel side, and the SDK verifies with Vercel's public key and encrypts the values displayed in the toolbar—removing the operational burden of "shared secrets" from the application layer.

Changes and Limitations of the Precompute Feature

Precompute is a Flags SDK feature that allows flag values to be computed ahead of time for improved performance. Without a secret, precompute-generated codes only work in the deployment that created them. This is because secret-less precompute relies on Vercel system environment variables (enabled by default).

If precompute codes need to be used across deployments, or if you use prebuilt deployments, a secret is still required. In this case, you can use FLAGS_PRECOMPUTE_SECRET to provide a key solely for precompute functionality without affecting other parts.

The official documentation specifically notes that if your project uses build cache, you need to configure it accordingly by referring to the precompute documentation to ensure proper functionality.

How precompute works: Precompute means calculating flag values for a given visitor context (such as cookies, geolocation, user segments) at build or deploy time, and encoding the results into a compact "code" embedded in the page or response headers. At runtime, the edge decodes it directly without calling back to the flag provider, reducing latency. Without a secret, the encryption key for this code is derived from Vercel system environment variables that are bound to the specific deployment, so the code can only be correctly decoded in the deployment that generated it—this explains the limitation of "only usable in the deployment that created it." For cross-deployment reuse or prebuilt deployment scenarios, the deployment ID changes, so a stable FLAGS_PRECOMPUTE_SECRET is still needed to ensure key consistency.

Benefits for Micro-Frontend Architectures

This update is especially valuable for teams using micro-frontend architectures. In micro-frontend scenarios, multiple independently deployed applications may share the same Flags Explorer or precompute logic. Previously, FLAGS_SECRET had to be kept in sync across all sub-applications, adding operational overhead. Now that Vercel centrally manages key signing and encryption, the risk of key leakage and desynchronization is reduced.

However, teams should note during migration: if some sub-applications still use the older SDK or explicit secrets while others have switched to Vercel-managed keys, inconsistent behavior may occur. It is recommended to upgrade all applications uniformly and remove secret configurations to fully benefit from the new mechanism.

The key synchronization problem in micro-frontend architectures: Micro-frontends split the frontend into multiple independently developed and deployed sub-applications, composed together by a shell. When multiple sub-applications share the same Flags Explorer session, override requests from the Explorer must be verified by each sub-application's own flag endpoint. If sub-applications are deployed separately with different FLAGS_SECRET values, they must be manually kept in sync via CI secret distribution or a configuration center—any omission causes some sub-applications to reject overrides, leading to inconsistent behavior. With Vercel-managed keys, the verifier becomes the platform public key, and all sub-applications naturally share the same root of trust, eliminating the operational step of cross-repository secret synchronization.

How to Migrate

For existing projects that want to switch to Vercel-managed keys, the steps are straightforward:

  1. Upgrade Flags SDK to version 4.5.0 or higher.
  2. Remove the FLAGS_SECRET environment variable.
  3. Delete any code that explicitly passes a secret.
  4. Run vercel env pull during local development to fetch the latest environment variables.

After completing these steps, Flags Explorer and precompute will automatically use Vercel-managed keys. For scenarios where precompute needs a separate secret, you can configure FLAGS_PRECOMPUTE_SECRET.

This update reflects Vercel's continued investment in developer experience—by reducing manual configuration and key management, developers can focus more on feature development. For more details, refer to the official Flags SDK documentation.

One-line Summary

Vercel Flags SDK 4.5.0 eliminates FLAGS_SECRET configuration, with the platform managing key signing and encryption.

Paragraph Summary

Vercel released Flags SDK 4.5.0, which removes the need for the FLAGS_SECRET environment variable when using Flags Explorer and precompute features on the Vercel platform. Under the new mechanism, Vercel signs Explorer discovery requests and overrides, and the SDK uses Vercel's public key to encrypt flag values displayed in the toolbar, reducing setup complexity for new projects. Existing projects do not switch automatically after upgrading—they must remove the environment variable and any explicitly passed secrets in code, then run vercel env pull to sync. Secret-less precompute codes only work in the deployment that created them; cross-deployment or prebuilt deployments still require a secret, which can be provided separately via FLAGS_PRECOMPUTE_SECRET. This update particularly benefits micro-frontend teams by reducing the risk of key leakage and desynchronization.

#Flags SDK 4.5.0#FLAGS_SECRET#Vercel#Flags Explorer#precompute#micro-frontend#FLAGS_PRECOMPUTE_SECRET
Share:

Related articles