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_URL or BETTER_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.
Prevention
Add error.tsx and global-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).

Full help articleThe Preview works but the live site doesn't

Last reviewed Nov 8, 2026