Nextjs deploy using server components with mongodb
juampicarosi
HOBBYOP

a year ago

I have a mongoDB instance and a Nextjs app.
I have a page that is server side and does a fetch to the mongodb instance and on build phase it throws the following error: getaddrinfo ENOTFOUND mongodb.railway.internal.
I added a 3 second timeout before the await mongoClient.connect(); but i still get the error.

View Deploy details

ⓘ Deployment information is only viewable by project members and Railway employees.

Solved

4 Replies

a year ago

The 3 seconds is not needed anymore, we have fixed that issue.

However, the private network is not available during build.


juampicarosi
HOBBYOP

a year ago

Noted, thanks for the quick response. I'll try to work around it from next


juampicarosi
HOBBYOP

a year ago

In case anyone drops here, i solved it making a dynamic import of the component that connects to mongo so that it only renders when requested by client


a year ago

Perfect, thanks for the follow up!


Status changed to Solved brody over 1 year ago


Loading...