My DATABASE_URL doesn't work so I have to put my DATABASE_PUBLIC_URL and it works
kefrankefran7609
PROOP

a month ago

I thought that the DATABASEURL from my Postgres database was made to use in my project which both are in the same service. It somehow works when is use the public one. I also have a weird message in my database: 'We are unable to connect to the database over the public network.'<:salute:1137099685417451530> Here's the error when using the DATABASEURL:

[15:08:50] ERROR: Error: cannot connect to Postgres. Details: getaddrinfo ENOTFOUND postgres.railway.internal
err: {
"type": "Error",
"message": "getaddrinfo ENOTFOUND postgres.railway.internal",
"stack":
Error: getaddrinfo ENOTFOUND postgres.railway.internal
at /app/nodemodules/pg-pool/index.js:45:11 at process.processTicksAndRejections (node:internal/process/taskqueues:105:5)
at async h (/app/.next/server/chunks/5800.js:28:25635)
at async Object.i as connect
at async bD.init (/app/.next/server/chunks/9162.js:130:7454)
at async /app/.next/server/app/(app)/api/services/route.js:1:1218
at async g (/app/.next/server/chunks/4753.js:1:19670)
at async p (/app/.next/server/app/(app)/lost-and-found/page.js:2:10038)
"errno": -3008,
"code": "ENOTFOUND",
"syscall": "getaddrinfo",
"hostname": "postgres.railway.internal"
}

Solved$10 Bounty

0 Replies

uxuz
MODERATOR

a month ago

Hey, has this always been the case (for example since you have created the database service) or did this happen abruptly? The error message shown in the screenshot suggests that the password is wrong. Have you modified any of the related service variables?


kefrankefran7609
PROOP

a month ago

I have 2 different issues in my post.
I think you're referring to the one saying: ' 'We are unable to connect to the database over the public network.' with the red text under.
This has always been like this, it's a brand new project I created 2 days ago. I just realized that it goes away most of the time when I reload the page and it doesn't affect the service, my live project is working fine, but I would like this project to go live asap and it scares me a bit.

The main issue is the fact that I have to use the DATABASEPUBLICURL instead of the DATABASE_URL for my project to build and deploy properly, which doesn't make sense.


uxuz
MODERATOR

a month ago

Private networking isn't available during build, which is most likely the reason. Depending on your use case, a predeploy step may be sufficient.


uxuz
MODERATOR

a month ago

!s


Status changed to Solved uxuz about 1 month ago


Loading...