Preview or Production site on Vercel
500: INTERNAL_SERVER_ERROR — Code: FUNCTION_INVOCATION_FAILED
- What it means
- Something crashed on the server while handling your request. Vercel hides the raw crash from visitors and records the real cause in the runtime logs.
- Likely causes
- A required environment variable (like
DATABASE_URLorBETTER_AUTH_SECRET) is missing in Preview or Production. - An unexpected database or third-party error was thrown without an error boundary or friendly return value.
- A required environment variable (like
- Prevention
- Add
error.tsxandglobal-error.tsx, and verify environment variable names in both Preview and Production before publishing.
Copy for your agent
The live or Preview site shows `500 FUNCTION_INVOCATION_FAILED`. Check the runtime logs with `npx vercel logs` and compare environment variable names with `npx vercel env ls` (never values).
Was this page helpful?