By abelborges
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.
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
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.
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.