By Joseph Cox
When I try to make a call to my DO PostGres database from my DO App, I get an error: {“code”:“SELF_SIGNED_CERT_IN_CHAIN”}
I’ve got the CA-Cert setup in my database connection:
databaseConfig = {
host: process.env.DBhost,
port: process.env.DBport,
database: process.env.database,
user: process.env.DBusername,
password: process.env.DBpassword,
ssl: {
rejectUnauthorized: true,
ca: process.env.CA_CERT,
},
sslmode: 'require'
};
Here are the summaries of what I have working: Build & Deploy: Local System: Good DO Hosted App: Good
Non-PostGres Pinging Request: Local System: Good DO Hosted App: Good
DO PostGres Pinging Request: Local System: Good DO Hosted App: Fail {“code”:“SELF_SIGNED_CERT_IN_CHAIN”}
This suggests that the DO Host alone can’t connect for some reason.
I’ve tried changing node middleware - no effect.
I’ve tried the VPC approach but I can’t seem to add my App to it and it shouldn’t matter anyway.
I’ve tried to add my own Let’s Encrypt certs to the DO App, but don’t have Sudo access and it shouldn’t matter anyway.
What do I need to do to make this work?
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!
Accepted Answer
Got it to work! Needed the SSL cert in file form, not in an environment variable.
This comment has been deleted
Heya,
You are correct, you’ll need your SSL cet in file form.
Additionally, regarding App Platform, if anyone stublmes upon this question, If you are using the DigitalOCean App Platform this is all done automatically. With the App Platform, DigitalOcean creates, manages, and renews your SSL certificates automatically.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.