R
Railway7mo ago
rhuynh

Postgres Migration Connection Issue

I just migrated my postgres db but I'm unable to connect and I get the following error could not receive data from client: Connection reset by peer. Not sure what's going on, but when I connect my server to the legacy postgres db it works just fine. The migration looks like it finished. I've tried re-deploying the new Postgres db, but still no luck. projectId: 6e514526-cb71-44b4-824d-f7ff0a10f9051
15 Replies
Percy
Percy7mo ago
Project ID: 6e514526-cb71-44b4-824d-f7ff0a10f905
Raigato
Raigato7mo ago
Same here Full error logs for me (all these lines are in red): 2023-11-29 08:40:09.244 UTC [7] LOG: starting PostgreSQL 15.4 (Ubuntu 15.4-2.pgdg22.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit 2023-11-29 08:40:09.244 UTC [7] LOG: listening on IPv4 address "0.0.0.0", port 5432 2023-11-29 08:40:09.244 UTC [7] LOG: listening on IPv6 address "::", port 5432 2023-11-29 08:40:09.248 UTC [7] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2023-11-29 08:40:09.255 UTC [34] LOG: database system was interrupted; last known up at 2023-11-29 08:31:29 UTC 2023-11-29 08:40:09.295 UTC [34] LOG: database system was not properly shut down; automatic recovery in progress 2023-11-29 08:40:09.299 UTC [34] LOG: redo starts at 0/283F538 2023-11-29 08:40:09.299 UTC [34] LOG: invalid record length at 0/283F570: wanted 24, got 0 2023-11-29 08:40:09.299 UTC [34] LOG: redo done at 0/283F538 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s 2023-11-29 08:40:09.304 UTC [32] LOG: checkpoint starting: end-of-recovery immediate wait 2023-11-29 08:40:09.315 UTC [32] LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.004 s, sync=0.002 s, total=0.013 s; sync files=2, longest=0.002 s, average=0.001 s; distance=0 kB, estimate=0 kB 2023-11-29 08:40:09.323 UTC [7] LOG: database system is ready to accept connections 2023-11-29 08:40:09.328 UTC [37] LOG: TimescaleDB background worker launcher connected to shared catalogs
rhuynh
rhuynh7mo ago
Yeah my log trace is the same as @Raigato @Brody any updates on this?
Duchess
Duchess7mo ago
Thread has been flagged to Railway team by @Brody.
Greg Schier
Greg Schier7mo ago
Red postgres logs aren't actually errors. Postgres emits to both stdout and stderr for different types of log messages (not necessarily errors) It looks like everything is working in your project. Are you still seeing issues?
rhuynh
rhuynh7mo ago
Yes still having issues. It's giving me a different error now then before but essentially my prisma client can't seem to connect to the postgres database. I set the environment variables for my server as as ${{Postgres.DATABASE_URL}}
[19:45:54.237] ERROR (35):

Invalid `prisma.user.findFirst()` invocation:

Can't reach database server at `monorail.proxy.rlwy.net`:`15279`

Please make sure your database server is running at `monorail.proxy.rlwy.net`:`15279`.

err: {

"type": "PrismaClientInitializationError",

"message": "\nInvalid `prisma.user.findFirst()` invocation:\n\n\n Can't reach database server at `monorail.proxy.rlwy.net`:`15279`\n\nPlease make sure your database server is running at `monorail.proxy.rlwy.net`:`15279`.",

"stack":

Error:

Invalid `prisma.user.findFirst()` invocation:





Can't reach database server at `monorail.proxy.rlwy.net`:`15279`



Please make sure your database server is running at `monorail.proxy.rlwy.net`:`15279`.

at Object.request (/workspace/node_modules/@prisma/client/runtime/index.js:45411:15)

at async PrismaClient._request (/workspace/node_modules/@prisma/client/runtime/index.js:46301:18)

"clientVersion": "3.14.0"

}
[19:45:54.237] ERROR (35):

Invalid `prisma.user.findFirst()` invocation:

Can't reach database server at `monorail.proxy.rlwy.net`:`15279`

Please make sure your database server is running at `monorail.proxy.rlwy.net`:`15279`.

err: {

"type": "PrismaClientInitializationError",

"message": "\nInvalid `prisma.user.findFirst()` invocation:\n\n\n Can't reach database server at `monorail.proxy.rlwy.net`:`15279`\n\nPlease make sure your database server is running at `monorail.proxy.rlwy.net`:`15279`.",

"stack":

Error:

Invalid `prisma.user.findFirst()` invocation:





Can't reach database server at `monorail.proxy.rlwy.net`:`15279`



Please make sure your database server is running at `monorail.proxy.rlwy.net`:`15279`.

at Object.request (/workspace/node_modules/@prisma/client/runtime/index.js:45411:15)

at async PrismaClient._request (/workspace/node_modules/@prisma/client/runtime/index.js:46301:18)

"clientVersion": "3.14.0"

}
Yes I'm still having issues. My server is unable to connect to the database. I've set the environment variable for my server for the database as ${{Postgres.Database_URL}} Here's the logs
Invalid `prisma.user.findFirst()` invocation:

Can't reach database server at `monorail.proxy.rlwy.net`:`15279`

Please make sure your database server is running at `monorail.proxy.rlwy.net`:`15279`.

err: {

"type": "PrismaClientInitializationError",

"message": "\nInvalid `prisma.user.findFirst()` invocation:\n\n\n Can't reach database server at `monorail.proxy.rlwy.net`:`15279`\n\nPlease make sure your database server is running at `monorail.proxy.rlwy.net`:`15279`.",

"stack":

Error:

Invalid `prisma.user.findFirst()` invocation:





Can't reach database server at `monorail.proxy.rlwy.net`:`15279`



Please make sure your database server is running at `monorail.proxy.rlwy.net`:`15279`.

at Object.request (/workspace/node_modules/@prisma/client/runtime/index.js:45411:15)

at async PrismaClient._request (/workspace/node_modules/@prisma/client/runtime/index.js:46301:18)

"clientVersion": "3.14.0"

}

Segmentation fault (core dumped)

error Command failed with exit code 139.
Invalid `prisma.user.findFirst()` invocation:

Can't reach database server at `monorail.proxy.rlwy.net`:`15279`

Please make sure your database server is running at `monorail.proxy.rlwy.net`:`15279`.

err: {

"type": "PrismaClientInitializationError",

"message": "\nInvalid `prisma.user.findFirst()` invocation:\n\n\n Can't reach database server at `monorail.proxy.rlwy.net`:`15279`\n\nPlease make sure your database server is running at `monorail.proxy.rlwy.net`:`15279`.",

"stack":

Error:

Invalid `prisma.user.findFirst()` invocation:





Can't reach database server at `monorail.proxy.rlwy.net`:`15279`



Please make sure your database server is running at `monorail.proxy.rlwy.net`:`15279`.

at Object.request (/workspace/node_modules/@prisma/client/runtime/index.js:45411:15)

at async PrismaClient._request (/workspace/node_modules/@prisma/client/runtime/index.js:46301:18)

"clientVersion": "3.14.0"

}

Segmentation fault (core dumped)

error Command failed with exit code 139.
Greg Schier
Greg Schier7mo ago
Ah, got it. So it looks like you may have run into the incident we had this morning. I issued a redeploy of your service and it seems to have connected this time https://status.railway.app
rhuynh
rhuynh7mo ago
Hmm strange... I tried redploying and in the server logs I get this now
Segmentation fault (core dumped)

error Command failed with exit code 139.
Segmentation fault (core dumped)

error Command failed with exit code 139.
No other db errors showing int he logs. However when I try my local server on my machine and connecting to the postgres db on railway it seems to work just fine. Could it be an issue with server connection on railway? Service id for the server is 45bdfe3c-df2c-4cc2-aff6-806004775564
Greg Schier
Greg Schier7mo ago
Want to create a new help thread for this? It seems like it's an application-related issue, though it's strange that it doesn't happen locally Oh, I just noticed you're still using buildpacks. It may help to switch to Nixpacks under the build settings for that service
Greg Schier
Greg Schier7mo ago
No description
Greg Schier
Greg Schier7mo ago
We no longer support Heroku Buildpacks as an environment
rhuynh
rhuynh7mo ago
Ah I see, that would make sense. Sure let me try that and if it still doesn't work I'll start a new help thread. Thanks Greg 🙏
Greg Schier
Greg Schier7mo ago
No problem 🙂
rhuynh
rhuynh7mo ago
Looks like it's all working now. Thanks Greg. Just had to change to Nixpacks and redploy 🙌
Greg Schier
Greg Schier7mo ago
Woot! 👍