Skip to content

destroy and unlink disagree on whether or not a database is linked to an app #315

@cuducos

Description

@cuducos

Description of problem

Sometimes the command destroy says a database is linked when it is not linked (although it was in the past). When we try unlinking, we get a confusing message saying there is no link, but next, the destroy command works.

How reproducible

Every single time. We rotate a database monthly in an open-source project, and every single month, I see this bug.

Steps to Reproduce

  1. Link a database to an app (this creates a DATABASE_URL envvar on that app)
  2. Change the DATABASE_URL pointing elsewhere (maybe another PostgreSQL instance)
  3. Try to delete the database linked in step 1, and you get an error saying the database is linked to an app
  4. Try to unlink the database from the app, and you get a message saying the database actually is not linked to the app
  5. Try deleting once more, and this time it works

Actual Results

$ dokku postgres:destroy minhareceita202403
 !     Cannot delete linked service
$ dokku postgres:unlink minhareceita202403 minhareceita
 !     Not linked to app minhareceita
$ dokku postgres:destroy minhareceita202403

 !     WARNING: Potentially Destructive Action
 !     This command will destroy minhareceita202403 Postgres service.
 !     To proceed, type "minhareceita202403"
 

Expected Results

  • Either destroy command and unlink should say the database is linked
  • or none of them should say the database is linked

Environment Information

(not relevant)

dokku report APP_NAME output

(not relevant)

How (deb/make) and where (AWS, VirtualBox, physical, etc.) was Dokku installed?:

VPS via apt.

$ dokku version
dokku version 0.34.4

Additional information

(not relevant)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions