How can I attach MongoDB to DO Apps

Posted November 5, 2021 165 views
MongoDBNode.jsDigitalOcean 1-Click Apps MarketplaceDigitalOcean App PlatformDigitalOcean Managed MongoDB Database

I have a Express.js application running on DO Apps Platform.
I want to attach a Managed Mongo DB component to it but the DATABASE_URL is not connecting with the App.

I am getting this error

App starting error:  MongooseServerSelectionError: self signed certificate in certificate chain

I know the reason behind this. Because i am not specifying the crt file. But i don’t know how to add the crt file in the production.
If i just include it in the source files wouldn’t it be a security concern?

Is there any better way to attach mongoDB component to a DO Apps?

Note: I am using Node.js and Mongoose

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.

Submit an Answer
1 answer

Here’s a workaround.

ALERT: Not recommended and secured for production. Makes MITM attacks possible. Do so at your own risk.

In your NodeJS component on App Platform, add this as an environment variable


There are safer workarounds to the above though, but for quickly prototyping, the above is fine