Why is the Managed MongoDB showing as "failed to build" in App Platform?

I’m trying to deploy an App based on a docker image that I have. I need to connect it to an external mongo database so I set up a managed MongoDb and then added it as a component of the App.

Unfortunately, in the component settings all I see is:

Connection details are unavailable while the database is being provisioned.

In the deployment logs all I see is this:

Error: Database Not Available
Component Issues

db-wibble failed to build

I’ve tried to use the ${db-wibble.DATABASE_URL} env variable as the connection string for my app, but I don’t think it’s even getting as far as setting up the database (whatever that entails, as I can already connect to the managed DB directly). So the app never starts because it can’t connect to the database.

When adding the database component I recall seeing a warning that doing so would add a doapps user to the database, but no such user has been created.

What’s going on? Why does the App Platform seem to be broken here, and how can I fix this?

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.

Hello @jhannapearce ,

Currently, DATABASE_URL (or any other database bind variables) is not available during build. We plan on supporting build time access to databases soon though we don’t have any ETA.

Please change the scope of the Database variables to

- engine: PG
name: db
num_nodes: 1
size: db-s-dev-database
version: "12"
name: portal
region: nyc
- dockerfile_path: Dockerfile
scope: RUN_TIME
value: ${db.JDBC_DATABASE_URL}
scope: RUN_TIME
value: ${db.USERNAME}
scope: RUN_TIME
value: ${db.PASSWORD}

This should work! Hope this helps!

Cheers, Sri Charan