Checklist
Description
Description:
Since 8.10.0 when a deploy creates a brand new client AND adds that client's name to a connection's enabled_clients list in the same import run, the client gets created but is not enabled on the connection.
Why this happens:
The deploy-cli processes resources in a fixed order. Since v8.10.0, enabled_clients on connections/databases are managed via dedicated endpoints (PATCH /api/v2/connections/{id}/clients) instead of the legacy enabled_clients field on the connection PATCH payload.
The connection handler resolves client names to client IDs when building the list of clients to enable. If a client was just created earlier in the same deploy run, it seems like the connection handler either:
- Uses a stale cache of clients fetched at the start of the run (before the new client existed), or
- Processes connections before clients are fully registered
Either way, the new client's name can't be resolved to a client ID, so it gets silently skipped.
Workaround:
Deploy twice. The second run picks up the client that was created in the first run and enables it on the connection.
Version: 8.29.3 (also likely affects 8.10.0+ since that's when the dedicated endpoints were introduced)
Expectation
Deploy the new client and name it under enabled_clients once. The new client should be created and also enabled in database.json. Prior to 8.10.0, this is how it worked.
Reproduction
- Add a new client JSON file (e.g. clients/my-new-app.json)
- Add "My New App" to enabled_clients in a connection or database (e.g. database-connections/Username-Password-Authentication/database.json)
- Run a0deploy import
- The client is created, but it is NOT enabled on the connection
- Run a0deploy import a second time -- now it works because the client already exists
Deploy CLI version
8.29.0
Node version
20
Checklist
Description
Description:
Since 8.10.0 when a deploy creates a brand new client AND adds that client's name to a connection's
enabled_clientslist in the same import run, the client gets created but is not enabled on the connection.Why this happens:
The deploy-cli processes resources in a fixed order. Since v8.10.0, enabled_clients on connections/databases are managed via dedicated endpoints (
PATCH /api/v2/connections/{id}/clients) instead of the legacy enabled_clients field on the connection PATCH payload.The connection handler resolves client names to client IDs when building the list of clients to enable. If a client was just created earlier in the same deploy run, it seems like the connection handler either:
Either way, the new client's name can't be resolved to a client ID, so it gets silently skipped.
Workaround:
Deploy twice. The second run picks up the client that was created in the first run and enables it on the connection.
Version: 8.29.3 (also likely affects 8.10.0+ since that's when the dedicated endpoints were introduced)
Expectation
Deploy the new client and name it under
enabled_clientsonce. The new client should be created and also enabled in database.json. Prior to 8.10.0, this is how it worked.Reproduction
Deploy CLI version
8.29.0
Node version
20