When I try to connect my Strapi deployment to the postgres DB (also deployed on Fly), I get this error:
The server does not support SSL connections
Strapi builds just fine if I use a different postgres DB. I have had success with Supabase, Railway, and DigitalOcean’s managed databases. But I would prefer to use Fly for all of my deployments.
This is what my database.js config looks like:
module.exports = ({ env }) => ({
connection: {
client: "postgres",
connection: {
host: env("PGHOST", "127.0.0.1"),
port: env.int("PGPORT", 5432),
database: env("PGDATABASE", "strapi"),
user: env("PGUSER", "strapi"),
password: env("PGPASSWORD", "password"),
ssl: {
rejectUnauthorized: env.bool("DATABASE_SSL_SELF", false),
},
},
},
});
I’m assuming that your credentials are pointing to your Fly app, and not to localhost, as you show in this example. If so, you may need to set ssl
to false
as this warning in Strapi docs suggests:
Strapi is aware that there is an issue regarding SSL support for the server . In order to fix it, you have to set the ssl:{}
object as a boolean in order to disable it.
1 Like
Yep, all of my credentials are working. It works fine with other deployments of postgres.
ssl: env("DATABASE_SSL", false),
solved the problem!
I now have Remix, Strapi, and PostgreSQL working on Fly. This is awesome.
1 Like
Could setting this to false cause any problems with SSL for custom domains? This is probably a better question for the Strapi community.
No, this should only be related to using SSL to connect to the database.
1 Like
How are you deploying Strapi? Is it using Dockerfile? Which repository are you using?
@michaelfrieze How did you link Strapi and Remix? I have them both in seperate fly apps. I added the ‘Secrets’ in my Remix side fly app like:
STRAPI_API_URL="http://[strapi fly ip here]:1337/api"
STRAPI_URL="http://[strapi fly ip here]:1337"
SESSION_SECRET="[secret generated by fly]"