Skip to content

New client not added to connection's enabled_clients when created in the same deploy #1349

@raihans8379

Description

@raihans8379

Checklist

  • I have looked into the README and have not found a suitable solution or answer.
  • I have looked into the documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have upgraded to the latest version of this tool and the issue still persists.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

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:

  1. Uses a stale cache of clients fetched at the start of the run (before the new client existed), or
  2. 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

  1. Add a new client JSON file (e.g. clients/my-new-app.json)
  2. Add "My New App" to enabled_clients in a connection or database (e.g. database-connections/Username-Password-Authentication/database.json)
  3. Run a0deploy import
  4. The client is created, but it is NOT enabled on the connection
  5. Run a0deploy import a second time -- now it works because the client already exists

Deploy CLI version

8.29.0

Node version

20

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions