Skip to main content
Solved

Unable to Deploy IAM Groups: cognite.client.exceptions.CogniteAPIError: Failed to buffer the request body │ code: 400

  • February 11, 2025
  • 3 replies
  • 75 views

Forum|alt.badge.img+3

We have encountered a scenario where we are unable to continue deploying to our production environment.

 

The deployment fails on the IAM groups which indicate an HTTP Error 400 with a note indicating the Cognite API Failed to bugger the request body.

 

Here is the important parts of the error: 

 

...
Deploying 19 iam.groups(resource_scoped) to CDF...
╭──────────────────────────────────────────────────────────────────────────────╮
│ Traceback (most recent call last):                                           │
│   File                                                                       │
│ "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/cognit │
│ e_toolkit/_cdf_tk/commands/deploy.py", line 423, in _update_resources        │
│     updated = loader.update(resources)                                       │
│               ^^^^^^^^^^^^^^^^^^^^^^^^                                       │
│   File                                                                       │
│ "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/cognit │
│ e_toolkit/_cdf_tk/loaders/_resource_loaders/auth_loaders.py", line 402, in   │
│ update                                                                       │
│     return self._upsert(items)                                               │
│            ^^^^^^^^^^^^^^^^^^^                                               │
│   File                                                                       │
│ "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/cognit │
│ e_toolkit/_cdf_tk/loaders/_resource_loaders/auth_loaders.py", line 395, in   │
│ _upsert                                                                      │
│     created = self.client.iam.groups.create(changed)                         │
│               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                         │
│   File                                                                       │
│ "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/cognit │
│ e/client/_api/iam.py", line 408, in create                                   │
│     return self._create_multiple(                                            │
│            ^^^^^^^^^^^^^^^^^^^^^^                                            │
│   File                                                                       │
│ "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/cognit │
│ e/client/_api_client.py", line 949, in _create_multiple                      │
│     summary.raise_compound_exception_if_failed_tasks(                        │
│   File                                                                       │
│ "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/cognit │
│ e/client/utils/_concurrency.py", line 77, in                                 │
│ raise_compound_exception_if_failed_tasks                                     │
│     self._raise_basic_api_error(str_format_element_fn, **task_lists)         │
│   File                                                                       │
│ "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/cognit │
│ e/client/utils/_concurrency.py", line 104, in _raise_basic_api_error         │
│     raise CogniteAPIError(                                                   │
│ cognite.client.exceptions.CogniteAPIError: Failed to buffer the request body │
│ | code: 400 | X-Request-ID: 7481428e-608f-9fd7-9ed4-da06200cd69d | cluster:  │
│ az-eastus-1                                                                  │
│ The API Failed to process some items.                                        │
│ Successful (2xx): []                                                         │
│ Unknown (5xx): []                                                            │
│ Failed (4xx): [{'name':
....


 

 

Following the ‘name’ key are all of my IAM groups.

 

 

We have overcome this issue by disabling a module that contains all of the IAM groups for one of our locations.

We believe the YAML is not the issue, as we can deploy one site, or the other site, but not both together.

 

This error feels like it’s trying to pack all of our IAM groups into a single API Call, which is overflowing the API buffer.

 

We have disabled the one site of IAM groups from deploying but this presents an issue for scaling our implementation out as we have several other sites and each site will have a number of groups required.

 

Our current Cognite Toolkit version is 0.3.12.

 

Best answer by Anders Albert

@Jesse Jenken We have implemented a fallback when creating/updating groups, to do one-by-one requests if we get this error. The fix is release in 0.4.8 of Toolkit.

View original
Did this topic help you find an answer to your question?

Anders  Albert
Seasoned Practitioner
Forum|alt.badge.img

@Jesse Jenken Thank you for reporting this. I have logged it as a bug, and will implement a fix as you suggest, doing a fallback of creating Groups one by one.


Anders  Albert
Seasoned Practitioner
Forum|alt.badge.img

@Jesse Jenken We have implemented a fallback when creating/updating groups, to do one-by-one requests if we get this error. The fix is release in 0.4.8 of Toolkit.


Forum|alt.badge.img+3

Thanks ​@Anders Albert, for the quick turnaround! 

 


Reply


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings