Error while running `flyctl postgres attach`


I created a DB and an empty app and tried to attach the DB to the app and got this error:

❯ flyctl --verbose postgres attach -a api --postgres-app db --database-name app --database-user hasura --variable-name=HASURA_GRAPHQL_DATABASE_URL
Running flyadmin database-list
Running flyadmin user-list
Error unexpected end of JSON input

I ran the following commands:

flyctl postgres create --name db --organization supplize --region fra
flyctl apps create --name api
flyctl --verbose postgres attach -a api --postgres-app db --database-name app --database-user hasura --variable-name=HASURA_GRAPHQL_DATABASE_URL

I changed the app names. Tell me if you need the originals.

❯ flyctl image show db 
Current image details
  Registry   =                                                     
  Repository = flyio/postgres-standalone                                                
  Tag        = 14.1                                                                     
  Version    = v0.0.5                                                                   
  Digest     = sha256:b59c6c33c1e019b8942b0992df60bb3fd52db4811ddefc93e1d0b9aac5d9c68e  

Will you try rerunning with LOG_LEVEL=debug fly pg attach ...?

That error means the script that lists users returned something unexpected. It’s possible this is because the connection was interrupted. You can try running that command directly to see what the output is:

fly ssh console -a <postgres-name> -C "flyadmin user-list"

Well, after not working all night yesterday it’s finally working. But it’s good to know about LOG_LEVEL=debug. How is it different from --verbose? Maybe it should be documented. Are the docs open source?

Docs are open! GitHub - superfly/docs