Error to connect on databa service (Postgrees) from an api services
I am getting an issue after the build on my backend(node) service on railway:
(node:7) [DEP0040] DeprecationWarning: The
punycode
module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ...
to show where the warning was created)
[ERROR] PrismaClientInitializationError: Can't reach database server at monorail.proxy.rlwy.net
:33778
Please make sure your database server is running at monorail.proxy.rlwy.net
:33778
.
at startFn (/app/node_modules/@prisma/client/runtime/index.js:27186:17) {
clientVersion: '4.4.0',
errorCode: 'P1001'
}
But the database is running, and while the build we connect to the database for check the migrations and everything works normally, but on the deploy logs the procjet receive this erros.
but if i run my project locally and set the database for my database remote from railway, the project works normally![No description](https://cdn.answeroverflow.com/1197337540542353558/image.png)
Solution:Jump to solution
can you try the proposed solution by this user?
https://discord.com/channels/713503345364697088/1194241277517115443/1194568475071483944...
7 Replies
Project ID:
ff5eeed5-c565-48eb-8aab-ab64eab41500
ff5eeed5-c565-48eb-8aab-ab64eab41500
Solution
can you try the proposed solution by this user?
https://discord.com/channels/713503345364697088/1194241277517115443/1194568475071483944
sure, testing it now.
my database url is like: postgresql://[USER]:[PASS]@monorail.proxy.rlwy.net:33778/railway?connect_timeout=30&pool_timeout=30&socket_timeout=30
yes but please make sure you are using referance variables, never hardcode the connection string
https://docs.railway.app/guides/variables#referencing-another-services-variable
It's worked to me, thank you so much
no problem