diff --git a/.changeset/fix-init-varlock-env-cached-path.md b/.changeset/fix-init-varlock-env-cached-path.md new file mode 100644 index 00000000..b31775cc --- /dev/null +++ b/.changeset/fix-init-varlock-env-cached-path.md @@ -0,0 +1,5 @@ +--- +"@varlock/nextjs-integration": patch +--- + +Fix: call `initVarlockEnv()` in the cached-env code path so the `ENV` proxy is properly initialized at runtime (e.g., on Vercel serverless), not just at build time. diff --git a/packages/integrations/nextjs/src/next-env-compat.ts b/packages/integrations/nextjs/src/next-env-compat.ts index 78234840..5ddcc88c 100644 --- a/packages/integrations/nextjs/src/next-env-compat.ts +++ b/packages/integrations/nextjs/src/next-env-compat.ts @@ -300,6 +300,7 @@ export function loadEnvConfig( Object.entries(varlockLoadedEnv.config).map(([key, value]) => [key, value.value]), ); + initVarlockEnv(); resetRedactionMap(varlockLoadedEnv); debug('patching console with varlock redactor'); patchGlobalConsole();