Checklist
Description
After opting out of the "Legacy Management of Connection's Enabled Clients" migration toggle (Tenant Settings > Advanced > Migrations), running a0deploy import with AUTH0_EXCLUDED_CLIENTS configured in the config JSON crashes during processChanges for the databases type:
error: Problem running command import during stage processChanges when processing type databases
error: Cannot read properties of undefined (reading 'includes')
Root cause:
In lib/tools/utils.js, the getEnabledClients function accesses conn.enabled_clients.includes(...) without a null/undefined check:
existing.forEach((conn) => {
if (conn.name === connection.name) {
excludedClients.forEach((excludedClient) => {
if (conn.enabled_clients.includes(excludedClient)) { // <-- crashes here
enabledClients.push(excludedClient);
}
});
}
});
When the legacy toggle is off, the Auth0 Management API no longer returns enabled_clients on connection objects. The databases.js handler's getType() method fetches enabled clients via the new dedicated endpoint and assigns them, but only when the returned array is non-empty. If the array is empty or the response shape differs, conn.enabled_clients remains undefined, causing the crash when combined with AUTH0_EXCLUDED_CLIENTS.
Suggested fix:
if (conn.enabled_clients?.includes(excludedClient)) {
Related issue: #1353 — similar TypeError: Cannot read properties of undefined in processChanges, also likely stemming from the node-auth0 v4→v5 transition and the move to dedicated connection endpoints.
Expectation
a0deploy import should complete successfully when:
- The tenant's "Legacy Management of Connection's Enabled Clients" migration toggle is off (opted out of legacy behavior, per Auth0's migration guidance)
AUTH0_EXCLUDED_CLIENTS is configured in the config JSON
- The
databases section in tenant.yaml includes enabled_clients
Reproduction
- Configure
AUTH0_EXCLUDED_CLIENTS in your .config.json with at least one client name
- Have a
databases section in your tenant.yaml with enabled_clients defined on at least one database connection
- In the Auth0 Dashboard, go to Tenant Settings > Advanced > Migrations
- Toggle off "Legacy Management of Connection's Enabled Clients"
- Run
a0deploy import -c config.json -i tenant.yaml
- Observe the crash at the
databases processChanges stage
Deploy CLI version
8.31.0
Node version
v25.8.2
Checklist
Description
After opting out of the "Legacy Management of Connection's Enabled Clients" migration toggle (Tenant Settings > Advanced > Migrations), running
a0deploy importwithAUTH0_EXCLUDED_CLIENTSconfigured in the config JSON crashes duringprocessChangesfor thedatabasestype:Root cause:
In
lib/tools/utils.js, thegetEnabledClientsfunction accessesconn.enabled_clients.includes(...)without a null/undefined check:When the legacy toggle is off, the Auth0 Management API no longer returns
enabled_clientson connection objects. Thedatabases.jshandler'sgetType()method fetches enabled clients via the new dedicated endpoint and assigns them, but only when the returned array is non-empty. If the array is empty or the response shape differs,conn.enabled_clientsremainsundefined, causing the crash when combined withAUTH0_EXCLUDED_CLIENTS.Suggested fix:
Related issue: #1353 — similar
TypeError: Cannot read properties of undefinedinprocessChanges, also likely stemming from the node-auth0 v4→v5 transition and the move to dedicated connection endpoints.Expectation
a0deploy importshould complete successfully when:AUTH0_EXCLUDED_CLIENTSis configured in the config JSONdatabasessection intenant.yamlincludesenabled_clientsReproduction
AUTH0_EXCLUDED_CLIENTSin your.config.jsonwith at least one client namedatabasessection in yourtenant.yamlwithenabled_clientsdefined on at least one database connectiona0deploy import -c config.json -i tenant.yamldatabasesprocessChangesstageDeploy CLI version
8.31.0
Node version
v25.8.2