A0deploy CLI import is not working as expected

Problem statement

When trying to import a few client applications to Alpha from Beta, I received the below error.

2023-01-20T15:58:32.854Z - info: Processing directory .
2023-01-20T15:58:32.869Z - info: Getting access token for .../[xxx.xxx.auth0.com](http://xxx.xxx.auth0.com/)
2023-01-20T15:58:37.755Z - error: Problem running command import during stage processChanges when processing type clients
2023-01-20T15:58:37.755Z - error: Problem creating clients {"name":"0 - Car Care Android - ALPHA","client_id":"xxx"}
Bad Request: A client with the ID xxx already exists

Here are the steps I took:

  • Exported all beta tenant client application
  • Selected a few of them to import to the Alpha tenant
  • created a correct alpha_config.json file for the Alpha tenant
  • ran command a0deploy import --config_file alpha_config.json --input_file . in the correct directory.

Few points to note,

  • If I try to import one application one at a time, I get the same error. But upon changing the client_id to something else, it imports correctly to the Alpha tenant.
  • I do not have those client_ids in my Alpha tenant, they only exist in Beta.
  • I am using a0deploy 7.15.2. (I have also tried with 5.5.7)

Steps to reproduce

Attempt to import the same Client ID as one that exists on the same instance.

Solution

Client ID validation runs at the environment level. This means that separate tenants in the same public cloud region or private environment cannot have duplicate Client IDs.