Thanks for this great video. I wasn’t aware of this register function.
In the meantime, I figured out a couple of things too.
config/database always run before config/env/production/database.
I had the console.log(‘final configuration’, connections[client]); in the config/database file, so that’s the reason why it was always printing the default values.
After realizing this, I put a console log into the config/env/production/database files as well, and that had the correct configuration:
Above I’m logging the entire connection object and inside that connection.ssl to make sure it’s set to { rejectUnauthorized: false }
I also tried:
- downgrading pg to version 7
- using
ssl: { ca: env('DATABASE_CA') }- with the right certificate set, this was visible in the logs too - using
ssl: { ca: env('DATABASE_CA'), rejectUnauthorized: false }
But none of these worked. I also tried various combinations of these in the 36 deployments that I did.
If you think logging in the register callback has the potential to show us something we don’t know, I could set up the entire stack again and give it another shot.
