500 Internal Server Error on Vercel: FUNCTION_INVOCATION_FAILED
A Vercel Function crashed or threw an unhandled error. Read the application logs, then check the function code, its configuration and the services it calls.
FUNCTION_INVOCATION_FAILED (Internal Server Error)What it means
Vercel documents FUNCTION_INVOCATION_FAILED, and the related INTERNAL_FUNCTION_INVOCATION_FAILED, as a function invocation that fails. The possible causes it lists are a crashed runtime process (Node.js, Bun, Python and others) and an unhandled rejection or uncaught exception.
How to fix it
- Read the application logs to find the error behind the invocation. They are under the Logs tab, or at the deployment's host URL under the /_logs path.
- Review the function code for errors and infinite loops.
- Wrap the work in a try/catch block so an error produces a response you can log.
- Verify the function configuration, including its environment variables.
- If the function calls an external service, check that the service is responding.
// Example: return a response instead of letting the invocation crash
export async function GET() {
try {
const data = await loadData();
return Response.json(data);
} catch (error) {
console.error("loadData failed", error);
return Response.json({ error: "Internal error" }, { status: 500 });
}
}What a DeployDoctor scan can check
A scan cannot see an exception that only happens at runtime. It can report two documented configuration causes ahead of time: process.env reads that are missing from .env.example, and server code Vercel cannot run, such as packages that need Node-only APIs in an Edge route.
Sources
- Vercel documentation: FUNCTION_INVOCATION_FAILED
- Vercel documentation: INTERNAL_FUNCTION_INVOCATION_FAILED
Documentation last checked 2026-10-28. Vercel can change its documentation; confirm against the linked pages.