Skip to content

auth0 users create fails with 'no active database connections' when enabled_clients is null #1533

@davidlovas

Description

@davidlovas

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 project 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

auth0 users create fails with "There are currently no active database or passwordless connections to choose from" when a connection has enabled_clients: null in the API response (the default, meaning enabled for all applications).

The root cause is in internal/cli/users.godatabaseAndPasswordlessConnectionOptions() filters connections with:

if len(connection.GetEnabledClients()) == 0 {
    continue
}

GetEnabledClients() returns nil when enabled_clients is null. In Go, len(nil) == 0 is true, so connections enabled for all apps are incorrectly skipped, same as connections explicitly disabled (empty slice).

Same bug in 3 places: createUserCmd() (line 407), importUsersCmd() (line 897), databaseAndPasswordlessConnectionOptions() (line 999).

Expectation

auth0 users create should succeed when the connection has enabled_clients: null, since null means enabled for all applications.

Reproduction

  1. Have a tenant with a Username-Password-Authentication connection where enabled_clients is null (the default)
  2. Verify the connection works: auth0 api post "users" --data '{"connection":"Username-Password-Authentication","email":"test@example.com","name":"Test","password":"Test12345!","email_verified":true}' — succeeds
  3. Try: auth0 users create -c "Username-Password-Authentication" -e "test@example.com" -n "Test" -p "Test12345!" --no-input — fails with "no active database or passwordless connections"

Same connection, same tenant — Management API works, users create does not.

Auth0 CLI version

1.31.0 (also reproduced on 1.29.0)

Fix

Draft PR with fix and local test verification: #1532

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions