CX as Code : Not able to export users list

Below is the resource export I am trying to do -

"resource "genesyscloud_tf_export" "export" {
** directory = "./Users"**
** resource_types = ["genesyscloud_user"]**
** include_state_file = true**
** export_as_hcl = true**
** log_permission_errors = true**
}"

But getting below error message, please suggest.


│ Error: Failed to get page of users: API Error: 400 - BAD_REQUEST (58bb6f3e-e59d-4443-89e7-ce9597ee4886)

│ with genesyscloud_tf_export.export,
│ on export.tf line 1, in resource "genesyscloud_tf_export" "export":
│ 1: resource "genesyscloud_tf_export" "export" {

Hey Amit,

Thanks for posting. Can you set the sdk_debug=true in the provider and then post the correlation id from the log for the API call that is failing? Also, can you tell me the Genesys Cloud AWS region you are working in? We are going to try to reproduce it in our labs, but if they are something specific to your org that is triggering a defect we will need to look in our logs.

Thanks,
John Carnell
Director, Developer Engagement

Hi John,

I have set the sdk_debug=true, Correlation id : 8931a155-9380-4c81-bf7f-efb0ed798e59.

Region : US-West-2

Thanks,
Amit

Hi Amit,

So I dug into this and what you are running into is a limitation with our internal search cluster. When we do the getAllUsers call there are situations where our user service will shunt the request over to the internal search cluster.

If your OAuth client allows is set up to see multiple divisions or the call also pulls back inactive users the requests flip over to our search cluster. Our search cluster will return 10,000 records back and then return 400 HTTP status codes indicating it is a bad request. They return a 400 because they don't want clients retrying if they sent back a 429.

While this search limitation is documented here, there is no obvious connection back to the user api. Here is what I would do:

  1. The limit is a hard limit and can not be changed. Since CX as Code pulls both inactive and active users (per other customer requests) we can not change the functionality of the provider.
  2. If you just want to do an export you could set up individual client oauth ids that have visibility to a single division. You could then use the Genesys cloud cli (gc users list -a) and try to pull back the records. As long as the OAuth client id's role is only assigned to a single division you might be able to get beyond this limit, but I can not guarantee you will not run into any issues. Many of our services have carefully documented their rate limits, but the directory service is one of our older services and has nooks and crannies that are not always up to date.
  3. I will add some documentation to the CX as Code genesyscloud_user resource to help give people a heads-up of this limitation.

Just out of curiosity. Why are you doing a complete export? Are you trying to migrate users back from a prod back to a dev org.

Thanks,
John Carnell
Director, Developer Engagement

Hi John,

Yes, just wanted to run this on dev org before executing on Prod org.

The above details help, I will try the CLI approach for division specific User export.

Much appreciate your help on this one.

Thanks,
Amit

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.