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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.