Database not visible inside a project
Database not visible inside a project
If you created a database but cannot select it from a project, or your application cannot connect at runtime, follow these steps to attach and expose it correctly.
1
Confirm the database is active
Open Database and check that the database status shows active. A database that is still provisioning or in an error state cannot accept connections.
2
Open the project overview or architecture view
Navigate to the project you want to connect the database to.
3
Add the database as a sub-service
In the project overview or architecture view, add the existing database as a sub-service. This registers the database as a dependency of the project and makes the connection details available.
4
Add the database URL to environment variables
In the project Environment settings, add the connection string as an environment variable — typically named
DATABASE_URL. Copy the value from the database detail page.5
Redeploy the project
Trigger a new deployment so the running container starts with the updated environment. Environment variable changes do not take effect in already-running containers.
Container checklist
Container checklist
Use this checklist to verify everything is configured correctly before investigating further.
If your application runs migrations automatically on startup, make sure they are idempotent. Running migrations on every restart in a multi-instance deployment can cause race conditions.
