I'm trying to deploy a next js app with vercel and I'm getting a 504 serverless function invocation error. The website told me to check the logs, so I did but I can't interpret what they mean. I attached a photo.
Anybody have any idea what's wrong? 
-
1redeployed to heroku, checked heroku logs, was b/c I didn't have my ip whitelist for mongodb atlas set up write. Had to whitelist all ipsklondike– klondike2021-10-09 00:05:56 +00:00Commented Oct 9, 2021 at 0:05
-
1I'm having the same issue with Vercel/NextJS, and I'd love to keep using it, but I'm not sure how to whitelist my database IP on Vercel. Does Heroku automatically deploy NextJS /api routes?Angus Ryer– Angus Ryer2021-11-22 04:29:29 +00:00Commented Nov 22, 2021 at 4:29
-
2@AngusRyer Thank you for reminding me to whitelist the IP, your comment fixed my issue!GMaiolo– GMaiolo2021-12-11 04:03:46 +00:00Commented Dec 11, 2021 at 4:03
-
1To clarify my comment above--I'm using Google Cloud Platform for my Postgres DB and I had to whitelist my IP there. Since Vercel's IPs are dynamic, I had to use 0.0.0.0/0.Angus Ryer– Angus Ryer2021-12-12 17:05:22 +00:00Commented Dec 12, 2021 at 17:05
Add a comment
|
1 Answer
check your getServerSideProps: Vercel has a timeout
when deployed to Vercel, it is probably exceeding the 10-sec max execution time (Hobby plan), resulting in a gateway timeout. In other words, you couldn’t load the site at all!
You can try the following
Bundle size (yep, size matters on the server side too) Performance of the code in getServerSideProps() Caching strategy use client-side rendering