a year ago
Why isn't private network not available on build?
--
ERROR: Error: cannot connect to MongoDB. Details: getaddrinfo ENOTFOUND mongodb.railway.internal
Project ID: 3ee24539-6cd8-4621-a3b4-1670d2fb1fca
NextJS Build Failed
Using Nixpacks
ⓘ Deployment information is only viewable by project members and Railway employees.
5 Replies
a year ago
Hello,
The private network is indeed not available during build due to technical limitation on how the current build system works.
Best,
Brody
Status changed to Awaiting User Response Railway • about 1 year ago
a year ago
So, what would be the ideal way to bypass this while still making use of Next.js' SSG?
Preferably, I would not use the public database URL.
--
Also, is there a plan to have private networks available during the build?
Status changed to Awaiting Railway Response Railway • about 1 year ago
a year ago
The way you could overcome it would be to do the page generations during runtime before starting the server, you can do this by moving the build command into the start command, make sure you are using a health check so that railway does not switch the new deployment into traffic before its ready to handle traffic.
And yes we do have plans to make the builder a part of the private network, but no ETA on that yet, sorry.
Status changed to Awaiting User Response Railway • about 1 year ago
a year ago
is there an example that I can follow to achieve this perhaps?
Status changed to Awaiting Railway Response Railway • about 1 year ago
a year ago
In your service settings, set the build command to something like echo skipping build and then set your start command to pnpm run build && pnpm run start
And then make sure to use a health check -
https://docs.railway.com/guides/healthchecks-and-restarts
Status changed to Awaiting User Response Railway • about 1 year ago
6 months ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • 6 months ago