2 years ago
the issue is like that; when i start project normally. it works and it connect database . there is no problem. but when i try with custom start command so its like that ; "npx prisma migrate deploy && npm start", it give bug which say it cant connect data base. how can i solve this problem. i have to migrate my prisma changes.. please help me
erorr is like that;
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "railway", schema "public" at "viaduct.proxy.rlwy.net:38891"
Error: P1001: Can't reach database server at viaduct.proxy.rlwy.net:38891
Please make sure your database server is running at viaduct.proxy.rlwy.net:38891.
npm WARN config production Use --omit=dev instead.
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
66 Replies
2 years ago
are you committing your .env file to your repo?
2 years ago
yes, I'm not saying that fixes your issue, but you never want to commit your .env file
2 years ago
go into the database's setting and remove the tcp proxy, then add it back
2 years ago
screenshot please
2 years ago
scroll back to the top
2 years ago
it's right there under public networking, remove it then add the same 5432 port back
2 years ago
add it back
2 years ago
have you added the tcp proxy back to the database?
2 years ago
i dont work for railway, so i wouldnt have access to such things
2 years ago
can you connect to the database locally from something like dbgate
you know whats intersting. when i start project without custom start .it connect succesfully
2 years ago
that is indeed odd
2 years ago
can you try to add a 3 second sleep before the migration command
2 years ago
i didnt mention anything about app sleeping
2 years ago
okay?
2 years ago
please try adding a 3 second sleep before the migration command
2 years ago
no
bro im so sorry i feel like stupid but i have to ask you how can ii add
2 years ago
whats your current start command and where is it set
2 years ago
send the start command here please
2 years ago
in text
2 years ago
why send an id?
2 years ago
sleep 3 && npx prisma migrate dev && npm start
2 years ago
you are no longer getting connection errors
2 years ago
there is not, why is that needed though?
2 years ago
awsome!









