Skip to main content

Hello,

We have off late moved from Rest calls to SDK and post that we have started seeing the below error

Error generating access token: invalid_request, 400, too many calls

 

What is recommended for this type of error ? Can’t we add a exponential delay at sdk side ?
Also it would be important for us to know that this error is given after how many calls ?
 

Hi - is this happening with AzureAD or Sauth?


Hi Murad,
Currently I checked on Sauth enabled project.


When is this happening? This is Sauth specific, it seems Sauth is doing rate limiting. We haven’t experienced this error with Azure AD.


Ok. So is sdk/rest api calling Sauth everytime its getting invoked even if the name of client is same ? anykind of caching being done ? What if you get Client config with same name or same instance of Client Config instead new one each time will there be change in the pattern of calling Sauth ?

Actually we saw below exception on rest endpoint invocation also for Sauth enabled cognite project.

Exception occured in fetch_combined_data method:HTTPSConnectionPool(host='westeurope-1.cognitedata.com', port=443): Max retries exceeded with url: /api/v1/projects/slb-pdf/userapis/spaces/QA_Test_Space/datamodels/QA_PERF_DATA/versions/1/graphql (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f770f7466d0>: Failed to establish a new connection: [Errno 111] Connection refused'))

In above case, we saw the error after 30k requests were successful and every this number changes. 

This might be different one altogether not related with Sauth, i think so. But just check


If you initialise the client Sauth will be called. The name is just used for reporting purposes in the API. If you initialise only at the start Sauth will only be called when the token needs a refresh (after one hour).

 

The error you pasted above is not related to Sauth, it seems to have been a small hickup on the API side. You could try to tune the retry settings in this SDK using client.config.GlobalConfig:


https://cognite-sdk-python.readthedocs-hosted.com/en/latest/cognite_client.html#cognite.client.config.GlobalConfig.max_retries_connect


Ok thanks for your response. One more query 
We are seeing below warnings, can you comment what are they, how is it impacting us and anything that we can do to avoid this

>urllib3.connectionpool] Connection pool is full, discarding connection: westeurope-1.cognitedata.com

..


Reply