Question

Connection details are unavailable while the database is being provisioned.

Hi 👋

I have trouble starting my App! It fails in the deployment phase (build is ✅) because to start it needs to have a database set up.

This is your most ordinary NodeJS app that uses a persistent session storage.

Here’s the output of my build:

[2021-12-20 14:57:08] yarn run v1.22.17
[2021-12-20 14:57:08] $ NODE_ENV=production node build/server.js
[2021-12-20 14:57:10] > App started http://localhost:3000
[2021-12-20 14:57:10] node:internal/process/promises:246
[2021-12-20 14:57:10]           triggerUncaughtException(err, true /* fromPromise */);
[2021-12-20 14:57:10]           ^
[2021-12-20 14:57:10] 
[2021-12-20 14:57:10] Error: getaddrinfo ENOTFOUND my_db
[2021-12-20 14:57:10]     at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) {
[2021-12-20 14:57:10]   errno: -3008,
[2021-12-20 14:57:10]   code: 'ENOTFOUND',
[2021-12-20 14:57:10]   syscall: 'getaddrinfo',
[2021-12-20 14:57:10]   hostname: 'my_db'
[2021-12-20 14:57:10] }
[2021-12-20 14:57:10] error Command failed with exit code 1.
[2021-12-20 14:57:10] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This means that the db is not yet ready so my app can’t connect. When I go to Settings > db (this is a dev database), at the connection details I see:

Connection details are unavailable while the database is being provisioned.

So I’m a bit confused about how can I get my app to start if it needs a database.

Thanks!


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.

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.

Encountered the same issue in one of my project and trying to find a solution for the last three days.

Hey there!

This error you are seeing is common when an application attempts to connect to the database during the build phase of your applications deployment process. With dev database’s they aren’t able to be connected to during the build phase and should be connected to during the run phase. I’d recommend modifying your application to connect during runtime rather then build if you would like to use a dev database.

If you need to connect during build then I’d recommend using a managed database instead. You would be able to connect to a managed database during build.

Managed Databases

Hope it helps! Nate