Reputation: 201
I recently deployed a Next.js application for a software engineering boot camp. I am using Vercel for hosting the web app. The problem I am having has been spoken about on the internet before. However, I couldn't find much helpful information.
When I look at the real-time logs for my application from my Vercel dashboard, a 504 error gets thrown for multiple API routes I have created. I am aware that Vercel places restrictions on requests depending on the hosting plan someone subscribes to. However, I can't help but wonder if I have overlooked an important step when deploying my application.
When deploying my application, I did the following things:
I would appreciate help finding out if these errors are my fault and if there is anything I can do about them or if they are solely caused by the restrictions of the "Hobby" plan.
Thank you very much in advance, -Sam
Upvotes: 2
Views: 4351
Reputation: 364
I'm using mongodb hosted at cloud.mongodb.com
and by default the unique allowed ip address is your local machine ip.
in cloud.mongodb.com
panel, go to networks
tab
click in the ADD IP ADDRESS
button and add your vercel dedicated project ip if you have one or you can allow all ip addresses using 0.0.0.0/0
Vercel uses dynamic ips and you can't have a dedicated one in the hobby plan
Due to the nature of the Vercel infrastructure, all outbound function requests come from a range of highly dynamic IP addresses and a fixed IP range cannot be given.
You can explore secure-compute which allow you get a dedicated IP (and some additional secure resources), but it is an enterprise plan though.
Upvotes: 1
Reputation: 131
You need to integrate MongoDB in your project on Vercel.
Go to your project settings in Vercel and go to the Integrations tab. Click the Browse Marketplace button and find MongoDb. Click Add Integration button and follow the instructions.
Hope this helps... I know this was asked quite a while ago.
Upvotes: 6
Reputation: 29
I had a similar issue, turned out, it was just the fact that I did not add the vercel ip addr to the network access page on mongodb so momgodb was blocking vercel from accessing data.
Upvotes: 2
Reputation: 3135
You have to troubleshoot the issue by doing the following
If #2 turns out to be the issue, reach out to vercel support - Another option could be hosting it outside and whitelisting the cross domain API ask from your application.
Upvotes: -1