Trouble setting up Postgres database connection for Node (Nest.js) app

Hey there! I’m currently trying to migrate my Nest.js backend from Heroku to Fly and I am running into issues with the setup, especially the database connection.

You can check this pull request to see where I’m currently at: https://github.com/herrherrmann/awesome-games-api/pull/8

I’ve set up a Fly app for the Node.js API and an app for the Postgres database and there’s a correct-looking DATABASE_URL secret defined in my app. But when I try to deploy the API with flyctl deploy, the database connection cannot be established:

2022-11-02T17:01:01.782 app[20548213] fra [info] [Nest] 520 - 11/02/2022, 5:01:01 PM [ExceptionHandler] The server does not support SSL connections +2ms

2022-11-02T17:01:01.783 app[20548213] fra [info] Error: The server does not support SSL connections 

I suspect there’s something wrong with reading the DATABASE_URL environment variable and/or the SSL setup, but I’m out of ideas right now about what can be adjusted there.

I also had to adjust the Dockerfile quite a bit to get that far (the auto-generated Dockerfile did not seem to be compatible with TypeScript and/or the required older Node version 10.15.3). I’m definitely not a Docker expert, so there might also be an issue with that one.

Can anyone give me a lead about what I can try next? That would be very much appreciated.

I am also running into this issue as well with a Scala application using the PlayFramwork. I am getting the following error:

2022-11-01T19:25:21.098 app[a01adcbc] den [info] Caused by: org.postgresql.util.PSQLException: The server does not support SSL.

try adding ?sslmode=disable to the DSN value in DATABASE_URL setting

try adding ?sslmode=disable to the DSN value in DATABASE_URL setting

This didn’t help, unfortunately.

Yea same here. I’m using the heroku buildpack to build my application, which builds out a JDBC_DATABASE_URL from the url stored in DATABASE_URL. It doesn’t look like its picking up the sslmode flag from the DATABASE_URL parameter

Since I wasn’t able to get everything running on Fly, I now decided to migrate my Node backend to Render instead. Feel free to close this thread.