App service not connecting to Postgres service

patriciosebastian
HOBBY

a month ago

Project ID: 8e7d74d8-df08-4f88-bc2a-002d6018e0d6
Environment: stage

Observations:

  • The application service and the postgres service can both be redeployed successfully

  • Visiting the website errors out with 502 bad gateway

  • The only error I see on the application service logs is a SQLSTATE connection to server error which makes sense when the db service is "sleeping", but that error goes away when I manually wake up the service.

  • These are the deploy logs from the postgres service (screenshot attached):

Its weird because all of the env variables and values are present and accurate, I double checked. But also, I've had this environment working perfectly for many months and haven't changed anything. It was working just a couple days ago, and even for a few minutes before it just seemingly crashed after a page refresh.

For whatever reason, it just seems like the db service is not able to be connected to?

Admittedly, there was an original error when the page first crashed as I mentioned above. The db service was reporting a collation version mismatch error, so I re indexed and refreshed the collation version, which completely resolved that error. What makes this interesting is that my dev environment is an exact copy of this stage environment (with the only exception being a custom stage domain) and it's currently working without any issues like both of them always have. Before I do something like duplicating the dev environment, I first want to know what's going on and find a solution so that I'm better prepared in case anything like this happens again or learn from an accidental mistake I may have made.

Stack: Laravel 12.0 & React 19.0

0 Replies

a month ago

Hey! On your postgres/database service, is it set to serverless?

1409620857722241000


patriciosebastian
HOBBY

a month ago

Hey, thanks for the reply! I just tried that a little bit ago and redeployed. Unfortunately, did not fix the issue.