Hi Vercel team — I’m seeing environment variables not being injected into my server runtime.
Project: welpoint
Production URL: https://welpoint.vercel.app/
Framework: Next.js App Router
API route: app/api/env-ok/route.ts
Runtime: nodejs (not Edge)
Dynamic: force-dynamic
Symptom
- In a diagnostic endpoint I print Object.keys(process.env) (names only).
- Only these show up from my project envs: NEXT_PUBLIC_SUPABASE_ANON_KEY and NEXT_PUBLIC_SUPABASE_URL.
- The following do NOT appear at runtime at all:
• SUPABASE_SERVICE_ROLE_KEY (server secret)
• SUPABASE_SERVICE_ROLE (alias I added to test)
• NEXT_PUBLIC_GMAPS_KEY
• SERVER_TEST_FLAG (simple test var I added)
What I expect - All variables defined in Project → Settings → Environment Variables (scoped to the current environment) should be available in process.env for serverless functions.
Repro steps
- Create an API route in the App Router with Node runtime:
export const runtime = ‘nodejs’;
export const dynamic = ‘force-dynamic’;
export async function GET() {
const allEnvNames = Object.keys(process.env).sort();
const hasService =
!!process.env.SUPABASE_SERVICE_ROLE_KEY || !!process.env.SUPABASE_SERVICE_ROLE;
const hasUrl =
!!process.env.NEXT_PUBLIC_SUPABASE_URL || !!process.env.SUPABASE_URL;
return NextResponse.json({ hasService, hasUrl, allEnvNames });
} - Define env vars in Project Settings → Environment Variables with Environments = Production, Preview, Development.
- Make a fresh deploy (new commit each time).
- Open https://welpoint.vercel.app/api/env-ok
Observed output (summary)
{
“hasService”: false,
“hasUrl”: true,
“allEnvNames”: [
“NEXT_PUBLIC_SUPABASE_ANON_KEY”,
“NEXT_PUBLIC_SUPABASE_URL”,
…only system vars (VERCEL_, AWS_, etc.)
]
}
What I’ve already tried
- Confirmed variables are set at Project level (not Team level).
- Selected Production/Preview/Development for each var.
- Fresh deploys (not just “Redeploy”) — new commit each time.
- Forced Node runtime + force-dynamic on the route.
- Renamed folders so the route is public (avoiding leading underscores).
- Created alias variables (SUPABASE_SERVICE_ROLE) and a simple SERVER_TEST_FLAG — neither appears at runtime.
- Still, the two NEXT_PUBLIC_SUPABASE_* do appear, so some envs are being injected.
Questions - Is there any known issue or setting that would prevent new/updated env vars from being injected into serverless runtime for App Router API routes?
- Could branch-level overrides or project configuration block specific keys from being available?
- Is there any cache or setting we should clear to force env propagation to serverless functions?
Happy to provide: - Screenshots of Project → Settings → Environment Variables
- Latest deployment ID
- The public diagnostic endpoint URL (above)
Thanks in advance!