Question

How do I find the SSL certificate required for database components in App Platform?

I’m trying to deploy a node.js application that interacts with a Postgres database via DO App Platform. I’m using the provided ${db.DATABASE_URL} environment variable and I can see it enforces SSL. I’m getting the UnhandledPromiseRejectionWarning: Error: self signed certificate in certificate chain runtime exception from Node, so that the deploy always fails. I’m using this lib. I’ve tried a few things from other questions here and on StackOverflow, all involving “disabling” SSL, including setting the rejectUnauthorized ssl option to true, all without success. That makes perfect sense because the DB requirement is still there, besides being not what I want (I want the secure deal). When the DB is created separately (for instance, when the app is droplet + DB), it looks like I could download the certificate, so that I could point to it as the lib documentation suggests, but that’s not the case with App Platform. From the plan description, I expect to have SSL everywhere. Is that only for the communication with publicly exposed endpoints?

Any help will be appreciated.


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Accepted Answer

Just found out the docs: https://www.digitalocean.com/docs/app-platform/how-to/use-environment-variables/#define-build-time-environment-variables

Using code like this and mapping environment variables accordingly worked for me.

Discovered next that the role has no permission to create schemas (so far only used the dev database), so you should create tables right into the default schema.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.