Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: connection is insecure (try using sslmode=require) #1526

Open
raulrene opened this issue Dec 3, 2024 · 2 comments
Open

ERROR: connection is insecure (try using sslmode=require) #1526

raulrene opened this issue Dec 3, 2024 · 2 comments

Comments

@raulrene
Copy link

raulrene commented Dec 3, 2024

Sequelize CLI [Node: 20.18.0, CLI: 6.6.2, ORM: 6.37.4]

I have multiple environments, and for lower environments I run the migrations using the config.json file. However, for Production I don't want to list the credentials in the file, nor do I want to have to set them up as env variables because there are multiple people working on the project and that means that all have to set them.

I would like to run migrations using the --url parameter

Using Postgres, stored on Neon.js. Running

npx sequelize-cli db:migrate --url "postgresql://{{username}}:{{password}}@{{host_url}}/{{db_name}}?sslmode=require"

is throwing an error

ERROR: connection is insecure (try using 'sslmode=require')

I tried using ssl=require, sslMode=require, sslmode=true, not providing it at all, etc.
However, I'm using this exact same connection string to connect the app to the DB, and it works fine. No matter what I do it doesn't seem to take the sslmode param into consideration. Any suggestions?

@WikiRik
Copy link
Member

WikiRik commented Dec 3, 2024

That might be missing functionality in the CLI, we do have something related to SSL here; https://github.com/sequelize/cli/blob/main/src/helpers/config-helper.js#L172
But that might not fix the usecase you have for Neon. Are you using pg? https://www.npmjs.com/package/pg

@raulrene
Copy link
Author

raulrene commented Dec 4, 2024

Hi. I took a look on the helper-config code and it seems to read the ssl value correctly if I pass ?ssl=true, however the error persists.

My error is directly using the Sequelize CLI, but indeed when connecting the app I had to include the dialectModule: pg option to make it work:

const DB_CONFIG = {
  dialect: 'postgres',
  dialectModule: pg,
  ssl: true,
  ....
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants