How to debug or handle Vercel FUNCTION_INVOCATION_FAILED error?

I got this error from Vercel. It pop up at random times and pages when I am navigating. There are no error raised in browser console. Vercel logs only build time error, so no info there also.

Maybe Vercel or Next.js is short in memory? These navigation works mostly, 'function invoication failed' error happens rarely. Like a ghost.

enter image description here

Answers

This means there's an error in either getServerSideProps or an API route, which is throwing a 500 on the server. You are correct this isn't shown in the console, because it's not happening on the client side.

Inside Vercel, you can view the Functions tab for real-time logs. Then, hit this error again and you'll be able to see the stack trace. If you can't reproduce it, set up logging with a Log Drain so you can track when it does happen.

https://vercel.com/docs/logs

Posted on by leerob

Relevant tags