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

For anyone else that comes across this error while attempting to deploy to heroku, here is how I fixed it.

I added the line ssl: { rejectUnauthorized: false } to the database connection settings.

It looks like the official strapi documentation now includes this, but I was attempting to deploy a legacy application that did not have this config. https://strapi.io/documentation/developer-docs/latest/concepts/configurations.html#example

return {
  connections: {
    default: {
      settings: {
        client: 'postgres',
        host: env('DATABASE_HOST', '127.0.0.1'),
        port: env.int('DATABASE_PORT', 5432),
        database: env('DATABASE_NAME', 'strapi'),
        username: env('DATABASE_USERNAME', 'strapi'),
        password: env('DATABASE_PASSWORD', 'strapi'),
        schema: 'public',
        ssl: { rejectUnauthorized: false }, // this line is required
      },
    }
  }
}