R
Railway6mo ago
Raigato

postgres could not receive data from client

I tried migrating one of my postgres database but keep getting "could not receive data from client: Connection reset by peer" errors when trying to reach it through an express server. Same behaviour with newly created Postgres database service.
Solution:
Sure, I added ?connect_timeout=30&pool_timeout=30&socket_timeout=30 at the end of the DATABASE_URL (initialy for migrations). Also, the issue seemed to come from an old Prisma package version which was triggering Segmentation fault errors. Updating it to latest solved the problem 🙌...
Jump to solution
6 Replies
Percy
Percy6mo ago
Project ID: ca07cd9d-fb81-4dce-ad1b-161d8d544c3e
Raigato
Raigato6mo ago
ca07cd9d-fb81-4dce-ad1b-161d8d544c3e The postgres service logs
Raigato
Raigato6mo ago
The express server service logs Prisma schema loaded from prisma/schema.prisma Datasource "db": PostgreSQL database "railway", schema "public" at "monorail.proxy.rlwy.net:24083" 5 migrations found in prisma/migrations Applying migration 20230327113536_add_auth_models Applying migration 20230327142924_cascade_delete_on_permission Applying migration 20230328083422_add_review_module Applying migration 20230331131732_init Applying migration 20231128084840_add_scores_module The following migrations have been applied: migrations/ └─ 20230327113536_add_auth_models/ └─ migration.sql └─ 20230327142924_cascade_delete_on_permission/ └─ migration.sql └─ 20230328083422_add_review_module/ └─ migration.sql └─ 20230331131732_init/ └─ migration.sql └─ 20231128084840_add_scores_module/ └─ migration.sql All migrations have been successfully applied. npm notice npm notice New major version of npm available! 9.5.0 -> 10.2.5 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.2.5>; npm notice Run npm install -g npm@10.2.5 to update! npm notice Server listening on port 7597 request completed Segmentation fault Prisma schema loaded from prisma/schema.prisma Datasource "db": PostgreSQL database "railway", schema "public" at "monorail.proxy.rlwy.net:24083" 5 migrations found in prisma/migrations No pending migrations to apply. ┌─────────────────────────────────────────────────────────┐ │ Update available 4.1.1 -> 5.7.1 │ │ │ │ This is a major update - please follow the guide at │ │ https://pris.ly/d/major-version-upgrade │ │ │ │ Run the following to update │ │ npm i --save-dev prisma@latest │ │ npm i @prisma/client@latest │ └─────────────────────────────────────────────────────────┘ Server listening on port 7597
Brody
Brody6mo ago
could you try adding a 3 second sleep to your start command?
Solution
Raigato
Raigato6mo ago
Sure, I added ?connect_timeout=30&pool_timeout=30&socket_timeout=30 at the end of the DATABASE_URL (initialy for migrations). Also, the issue seemed to come from an old Prisma package version which was triggering Segmentation fault errors. Updating it to latest solved the problem 🙌