Deploying Strapi to Production Heroku database

Viewed 683

I have an updated Strapi site, running V3.1.4 - we've come from a V3.0.6 site, with minimal structural changes. Strapi can connect to Postgres on my local version, and everything is fine, but when deploying to Heroku it gets more complicated.

I have a staging site using a Heroku Hobby database, with the following packages:

"knex": "^0.20.10",
"pg": "^8.0.3",
"pg-connection-string": "^2.3.0",

and my config uses:

options: {
        pool: {
          min: 0,
          max: 18,
          createTimeoutMillis: 30000,
          acquireTimeoutMillis: 600000,
          idleTimeoutMillis: 30000
        }
      }

and SSL is set to false.

This runs fine, but if I then deploy this to 'live' (ie using a Production database that requires SSL) I get the following error:

[DATABASE] [10-1] sql_error_code = 28000 FATAL: no pg_hba.conf entry for host "3.249.190.208", user "XXX", database "XXX", SSL off

I've had this before, and as per this post, I've taken PG down to V7.4.3, but I then get this error:

error KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?

and no cannot get this to work by altering any of thee pool settings, including using:

ssl:true,
rejectUnauthorized: false,

Node and NPM are set to:

  "engines": {
    "node": ">=10.0.0",
    "npm": ">=6.0.0"
  },

I think I've read most posts around this subject but nothing seems to be working. Any ideas greatly received.

1 Answers
Related