Unable to attach postgres database to app

When I try to attach my database to, an app hangs forever and doesn’t show any output, even with verbose output.

flyctl postgres attach -v -a ccdc-bot cyber-postgres

I’ve given it 5 minutes before canceling it. I’ve tried deleting both the app and the database app and recreating, with no luck.
Does anyone have anything to try so I can connect them?

Hey @Cyb3r-Jak3,

Could you provide the flyctl version you’re running as well as your Postgres image details?

You can see your image details by running:

flyctl image show --app <postgres-app>

Hi @shaun

Image version

flyctl image show --app cyber-postgres

Image Details
  Registry   = registry-1.docker.io                                                     
  Repository = flyio/postgres
  Tag        = 14.4
  Version    = v0.0.32
  Digest     = sha256:9daaa15119742e5777f5480ef476024e8827016718b5b020ef33a5fb084b60e8

Flyctl version

flyctl version

flyctl.exe v0.0.409 windows/amd64 Commit: 7de388a4 BuildDate: 2022-10-10T22:18:08Z

So it appears things may be getting hung up because your ccdc-bot app is not in a healthy state.

I figured it might be something like that, so I ran flyctl scale count 0 on the app and retired to attach with no luck.

I will get my app healthy then try to re-attach and let you know how it goes.

1 Like

@shaun It seemed to work now.
The behavior is odd. The application has a required environment variable of DATABASE_URL which wasn’t being set because the attach wouldn’t complete. I added a temporary URL then deployed a healthy version of the app then unset the secret, and it attached fine.