4

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? enter image description here

4
  • 1
    redeployed 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 ips Commented Oct 9, 2021 at 0:05
  • 1
    I'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? Commented Nov 22, 2021 at 4:29
  • 2
    @AngusRyer Thank you for reminding me to whitelist the IP, your comment fixed my issue! Commented Dec 11, 2021 at 4:03
  • 1
    To 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. Commented Dec 12, 2021 at 17:05

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.