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

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

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

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel