a year 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
0 Replies
a year ago
are you committing your .env file to your repo?
a year ago
yes, I'm not saying that fixes your issue, but you never want to commit your .env file
a year ago
go into the database's setting and remove the tcp proxy, then add it back
a year ago
screenshot please
a year ago
scroll back to the top
a year ago
it's right there under public networking, remove it then add the same 5432 port back
a year ago
add it back
a year ago
have you added the tcp proxy back to the database?
a year ago
i dont work for railway, so i wouldnt have access to such things
a year 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
a year ago
that is indeed odd
a year ago
can you try to add a 3 second sleep before the migration command
a year ago
i didnt mention anything about app sleeping
a year ago
okay?
a year ago
please try adding a 3 second sleep before the migration command
a year ago
no
a year ago
whats your current start command and where is it set
a year ago
send the start command here please
a year ago
in text
a year ago
why send an id?
a year ago
sleep 3 && npx prisma migrate dev && npm start
a year ago
you are no longer getting connection errors
a year ago
there is not, why is that needed though?
a year ago
awsome!