question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not using ssl and sslmode parameters with Heroku / Migrations folder

See original GitHub issue

I’m submitting a…

  • Bug report
  • Feature request
  • Question

Current behavior

When deploying to Heroku, I receive the following error:

[ERROR] AssertionError [ERR_ASSERTION]: ifError got unwanted exception: no pg_hba.conf entry for host "{redacted}", user "{redacted}", database "{redacted}", SSL off
    at module.exports (/app/node_modules/db-migrate/lib/commands/helper/assert.js:9:14)

Procfile:

release: db-migrate up
web: node server.js

Below is my database.json file. The environment in question is “production.”

{
  "development": {
    "driver": "pg",
    "user": {"ENV": "DATABASE_USER"},
    "password": {"ENV": "DATABASE_PASSWORD"},
    "host": {"ENV": "DATABASE_HOST"},
    "database": {"ENV": "DATABASE_NAME"},
    "schema": {"ENV": "DATABASE_SCHEMA"}
  },

  "staging": {
    "driver": "pg",
    "user": {"ENV": "DATABASE_USER"},
    "password": {"ENV": "DATABASE_PASSWORD"},
    "host": {"ENV": "DATABASE_HOST"},
    "database": {"ENV": "DATABASE_NAME"},
    "schema": {"ENV": "DATABASE_SCHEMA"}
  },

  "production": {
    "driver": "pg",
    "url": {"ENV": "HEROKU_POSTGRESQL_BLACK_URL"},
    "ssl": true,
    "sslmode": "require"
  }
}

I hard-coded the ssl and sslmode values after first trying them as environment variables.

I checked and the proper database name and user are being read from the URL.

Expected behavior

db-migrate attempts to connect using ssl.

Environment


db-migrate version: 0.11.6
db-migrate driver with versions: db-migrate-pg 1.0.0

Additional information:
- Node version: 12.3.1
- Platform:  Windows 10

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
paulmiller3000commented, Nov 13, 2020

@desmondmc Glad I could help!

0reactions
jasper-lyonscommented, Mar 30, 2021
* As @paulmiller3000 pointed out db-migrate kept using my `dev` config for some reason, even though i was passing `-e prod` to the db-migrate command (`heroku run db-migrate up --config database.json -e prod --app my-app`). It kept saying something about "prod not valid avoid using ';'"

Just solved this issue myself. FYI, the heroku command will eat your -e param so db-migrate never receives is. If you instead do heroku run bash and then run your commands from the bash cli, it should work (I had success with this).

Read more comments on GitHub >

github_iconTop Results From Across the Web

SSL error when pushing postgres db to heroku - Stack Overflow
psql: sslmode value "require" invalid when SSL support is not compiled in. I uninstalled postgres and reinstalled it with the configuration.
Read more >
Connecting to Relational Databases on Heroku with Java
We used to suggest adding the URL parameter sslmode=disable to JDBC URLs. We now require use of SSL for all new Heroku Postgres...
Read more >
How-To's - Miniflux
If you would like to connect via a Unix socket to Postgresql, set the parameter host=/path/to/socket/folder . Example: export DATABASE_URL="user=postgres ...
Read more >
Deployment | postfacto - GitHub Pages
For deployments that do not want to setup Google OAuth, you will need to create your ... the application settings to include the...
Read more >
Deploying Django to Heroku: Connecting Heroku Postgres
So, we'll use a hacky workaround to get dj_database_url to forget about SSL at the last second. As the very last line in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found