Next.js private database URL
jedpattersonn
HOBBYOP

2 years ago

I am deploying a Next.js app on Railway, where I also have a database hosted.
On my home page '/', I make a database call.

In production, I am using a private URL for the database to reduce network usage.

However, when Next.js is building, it is trying to prerender the page and the private URL hasnt initialised yet, causing the build to fail.

Is there a way around to fix this to continue using the private URL, or do I need to use the public one?

2 Replies

jedpattersonn
HOBBYOP

2 years ago

694c9ef5-c76e-4b0c-8f1f-bcd781caf44e


2 years ago

I think you can set the public database URL as the direct URL and the private database url as the normal URL, or vice versa


Loading...