From c31e116e3ca46a04e4ea74459c850d3fb742f3f4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Mar 2026 15:29:49 +0000 Subject: [PATCH 1/2] Initial plan From 7a293443032ffad38ece0c28bd21c0e21a5b0cd8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Mar 2026 15:33:48 +0000 Subject: [PATCH 2/2] fix: call initVarlockEnv() in cached-env path in next-env-compat.ts Co-authored-by: philmillman <3722211+philmillman@users.noreply.github.com> --- .changeset/fix-init-varlock-env-cached-path.md | 5 +++++ packages/integrations/nextjs/src/next-env-compat.ts | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/fix-init-varlock-env-cached-path.md 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();