Getting 502 Gateway error all of a sudden when trying to access endpoints that touches Postgres db (hosted in Supabase)

Getting 502 Gateway error all of a sudden when trying to access endpoints that touches Postgres db (hosted in Supabase).
npx prisma migrate deploy was fine so database is publicly accessible.

https://nepalist.fly.dev/categories returns 502, however
https://nepalist.fly.dev returns OK.

The problem is, I don’t see any relevant error messages anywhere

Looks like that error didn’t make it to your logs (from our proxy), but I see these:

http request: connection closed before message completed

Not entirely sure what causes it on your end, but that would mean the connection gets closed before response headers are fully sent back from your app.

It was fine until yesterday. I pushed more changes, created new tables in the database.

POST request to /users initially worked. I redeployed with database url to include pgBouncer and now reverted.
What could be possible reasons for this ?

Can you try restarting your database? I see some errors about an hour ago.

I tried restarting the whole supabase project twice already! Will give it a try again.
Also, maybe not related but I am unable to set the DATABASE_URL with pgBouncer true.

DATABASE_URL=postgres://postgres:password@db.url.supabase.co:6543/postgres?pgbouncer=true

Sorry, I misunderstood here. I thought the database was hosted on us.

I don’t know enough about supabase to help you on this precisely. I can look at your app and the errors generated by our proxy, but I don’t know what’s causing them from your app.

Ah right! I ended up using supabase because I couldn’t connect fly’s database with Prisma!

DATABASE_URL=postgres://postgres:password@nepalist-db.internal:5432/nepalist

for this url for example, npx prisma migrate deploy throws error.

Error: P1001: Can’t reach database server at nepalist-db.internal:5432

I used the connection string returned during the database creation.

Did you figure this out? Same issue for me.

I’m facing with an identical issue. Using Supabase database instead of the Fly Postgres database and trying to use it through Prisma.

The error is:

2023-10-13T09:29:12.742 proxy[48ed034cd04508] mad [error] could not complete HTTP request to instance: connection closed before message completed