Summary:
Two separate projects in my account are both crashing at cold start with the same Vercel-internal runtime error, before any of our application code executes:
Vercel Runtime Error: failed to load env vars: EnvFileReadError(Os { code: 2, kind: NotFound, message: "No such file or directory" })
Occurrence 1 — Node.js Serverless Function
- Project: API backend (NestJS, deployed as a single
api/index.jsNode.js Function) - Error:
500: FUNCTION_INVOCATION_FAILED - Request ID:
bom1::x9584-1784293362070-9e3e9c53bc61 - Region: build in
iad1, invocation inbom1
Occurrence 2 — Edge Middleware
- Project: Next.js frontend, standard
middleware.tsusing@supabase/ssr - Error:
500: MIDDLEWARE_INVOCATION_FAILED - Request ID:
bom1::dc6q8-1784295760739-560d7917758b
Why I believe this is platform-side, not application code:
- The error text is a Rust panic (
EnvFileReadError,Os { code: 2, kind: NotFound }), not a JavaScript/Node error — it fires before our code runs. - It reproduces identically across two completely different runtime types (Node.js Function vs. Edge Middleware) in two different projects, sharing no code or
vercel.jsonconfig. - I’ve audited both repos: no
.envfile is committed to git, noenvFilePathoverride in either app, no.vercelignore. - Redeployed the API project with “Use existing Build Cache” unchecked — same error, same message.
- Confirmed
/healthon the API project does work correctly when hit directly (returns valid JSON), so the deployment itself is healthy; the failure seems tied to specific invocation paths only.
What I’d like help with:
Please check server-side logs/traces for both request IDs above to identify what env-var-snapshot file the runtime expected and why it wasn’t present, and let me know if there’s an account-level setting or feature flag causing this