I am struggling to use the CA Cert provided by my Digital Oceans PSQL database.
I am using Knex in my Node.js Express application. Here is my Knex config:
production: {
client: 'postgresql',
connection: {
connectionString: process.env.PSQL_CONNECTION_STRING,
ssl: {
ca: Buffer.from(process.env.CA_CERT_BASE_64 ?? '').toString('utf-8')
}
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
I have tried the following things:
After all of this, I get the following error:
Error: self signed certificate in certificate chain
By setting NODE_TLS_REJECT_UNAUTHORIZED=0 in my environmental variables, I am able to connect to my database. However, I would like to avoid doing that.
Does anyone have any insight on what can be done?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there,
Are you doing this during the build process or during the run stage?
Keep in mind that Database values are not available during build time but are available at runtime as mentioned here in the docs:
If this is not the case, there has been a similar discussion here about the same use-case:
The solution that the user mentioned was to switch to using
Pool
frompg
:Let me know how it goes!
Best,
Bobby