edgedb-cli icon indicating copy to clipboard operation
edgedb-cli copied to clipboard

`init --non-interactive` does not populate the database or branch in credentials file

Open gscho opened this issue 6 months ago • 3 comments

  • Gel Version: 6.9+69ad2a3
  • Gel CLI Version: Gel CLI 7.4.0+bb0c441
  • OS Version: MacOS 15.5

Steps to Reproduce:

  1. gel init --server-instance example --database main --non-interactive
  2. cat "/edgedb/credentials/example.json"
  3. See that "database": null, "branch": null,

This is breaking the gel-go client since after a non-interactive install the client cannot connect to the gel instance because it can't build the DSN:

2025/07/16 13:15:17 Error creating Gel client: gel.ConfigurationError: cannot read credentials for instance "example": gel.ConfigurationError: cannot parse credentials in "/Users/redacted/Library/Application Support/edgedb/credentials/example.json": `database` must be a string
exit status 1

Workaround is to manually build the DSN from the credentials file json first and set GEL_DSN before launching.

gscho avatar Jul 16 '25 13:07 gscho

It looks like this is something we are not testing for explicitly in our shared client test cases, but if gel works to connect, the go client is supposed to be able to connect in the same manner, so I'll work with the Go binding folks to get this working.

scotttrinh avatar Jul 16 '25 14:07 scotttrinh

gel still works to connect. Not sure if there is some logic that if the branch is null use main baked into the CLI and other clients or not.

Probably still a minor bug as the output claims the branch is set and the behaviour of --non-interactive should likely populate the fields.

gscho avatar Jul 16 '25 14:07 gscho

Yeah, I confirmed locally that accepting the default in the --interactive mode sets the branch key in the credentials JSON explicitly to main, but when run non-interactively, it ends up as null and the Go client refuses to use it with:

gel.ConfigurationError: cannot read credentials for instance "tmp": gel.ConfigurationError: cannot parse credentials in "/home/strinh/.config/edgedb/credentials/tmp.json": `database` must be a string
exit status 1

scotttrinh avatar Jul 16 '25 18:07 scotttrinh