← All errors · VercelServerless & Edge Function errors
FUNCTION_INVOCATION_FAILED (500)
Exact error
500: INTERNAL_SERVER_ERROR. Code: FUNCTION_INVOCATION_FAILED
What it means
Your serverless function threw an unhandled error or crashed.
Likely causes
- An uncaught exception in an API route or server component.
- Missing env var at runtime (e.g. undefined API key).
- Importing a native/binary module unsupported in the runtime.
How to fix it
Open Vercel dashboard → your deployment → Logs, and find the stack trace for the request.
Wrap handler logic and return a useful error:
export async function GET() { try { const data = await doWork(); return Response.json(data); } catch (err) { console.error(err); return Response.json({ error: 'Internal error' }, { status: 500 }); } }Verify every runtime env var exists for the environment (Production vs Preview).
Prevent this next time
- Add timeouts to outbound requests and return clear error responses instead of crashing.
- Set up uptime checks and log alerts on critical endpoints so you hear about failures before users do.
Guide: catch outages before your users do.
FAQ
What does "FUNCTION_INVOCATION_FAILED (500)" mean?
Your serverless function threw an unhandled error or crashed.
What usually causes it?
An uncaught exception in an API route or server component. Missing env var at runtime (e.g. undefined API key). Importing a native/binary module unsupported in the runtime.
How do I fix it?
1. Open Vercel dashboard → your deployment → Logs, and find the stack trace for the request. 2. Wrap handler logic and return a useful error: 3. Verify every runtime env var exists for the environment (Production vs Preview).
Related errors
Get new fixes weekly
No spam. Unsubscribe anytime. Privacy