"KeyError: 'role_" - Error while running orders: botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://sts.US.amazonaws.com/" #917
Unanswered
GlowSharpie
asked this question in
Q&A
Replies: 1 comment 4 replies
-
This is hard to debug without full knowledge of the infrastructure. Did you try to run it with only the |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've double, triple, and quadruple checked ALL of my credentials and I have followed each step in amazon's documentation at https://developer-docs.amazon.com/sp-api/docs/creating-and-configuring-iam-policies-and-entities however every time I run my code I receive the following error:
Traceback (most recent call last):
File "F:\Python\lib\site-packages\cachetools_init_.py", line 68, in getitem
return self.__data[key]
KeyError: 'role_74fc5af19254feae9a64bd3255ef2ac6'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Python\lib\site-packages\sp_api\base\client.py", line 112, in role
role = role_cache[cache_key]
File "F:\Python\lib\site-packages\cachetools_init_.py", line 418, in getitem
return cache_getitem(self, key)
File "F:\Python\lib\site-packages\cachetools_init_.py", line 70, in getitem
return self.missing(key)
File "F:\Python\lib\site-packages\cachetools_init_.py", line 97, in missing
raise KeyError(key)
KeyError: 'role_74fc5af19254feae9a64bd3255ef2ac6'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\GlowSharpie\Desktop\Python Scripts\Barcode Creation\FBA\SP API\SP_API_Test3.py", line 16, in
order = order_client.get_order('113-2528766-2545802')
File "F:\Python\lib\site-packages\sp_api\base\helpers.py", line 20, in wrapper
return function(*args, **kwargs)
File "F:\Python\lib\site-packages\sp_api\api\orders\orders.py", line 95, in get_order
return self._request(fill_query_params(kwargs.pop('path'), order_id), params={**kwargs}, add_marketplace=False)
File "F:\Python\lib\site-packages\sp_api\base\client.py", line 153, in _request
auth=self._sign_request(),
File "F:\Python\lib\site-packages\sp_api\base\client.py", line 122, in _sign_request
role = self.role
File "F:\Python\lib\site-packages\sp_api\base\client.py", line 114, in role
role = self.set_role(cache_key)
File "F:\Python\lib\site-packages\sp_api\base\client.py", line 81, in set_role
role = self.boto3_client.assume_role(
File "F:\Python\lib\site-packages\botocore\client.py", line 530, in _api_call
return self._make_api_call(operation_name, kwargs)
File "F:\Python\lib\site-packages\botocore\client.py", line 943, in _make_api_call
http, parsed_response = self._make_request(
File "F:\Python\lib\site-packages\botocore\client.py", line 966, in _make_request
return self._endpoint.make_request(operation_model, request_dict)
File "F:\Python\lib\site-packages\botocore\endpoint.py", line 119, in make_request
return self._send_request(request_dict, operation_model)
File "F:\Python\lib\site-packages\botocore\endpoint.py", line 202, in _send_request
while self._needs_retry(
File "F:\Python\lib\site-packages\botocore\endpoint.py", line 354, in _needs_retry
responses = self._event_emitter.emit(
File "F:\Python\lib\site-packages\botocore\hooks.py", line 412, in emit
return self._emitter.emit(aliased_event_name, **kwargs)
File "F:\Python\lib\site-packages\botocore\hooks.py", line 256, in emit
return self._emit(event_name, kwargs)
File "F:\Python\lib\site-packages\botocore\hooks.py", line 239, in _emit
response = handler(**kwargs)
File "F:\Python\lib\site-packages\botocore\retryhandler.py", line 207, in call
if self._checker(**checker_kwargs):
File "F:\Python\lib\site-packages\botocore\retryhandler.py", line 284, in call
should_retry = self._should_retry(
File "F:\Python\lib\site-packages\botocore\retryhandler.py", line 320, in _should_retry
return self._checker(attempt_number, response, caught_exception)
File "F:\Python\lib\site-packages\botocore\retryhandler.py", line 363, in call
checker_response = checker(
File "F:\Python\lib\site-packages\botocore\retryhandler.py", line 247, in call
return self._check_caught_exception(
File "F:\Python\lib\site-packages\botocore\retryhandler.py", line 416, in _check_caught_exception
raise caught_exception
File "F:\Python\lib\site-packages\botocore\endpoint.py", line 281, in _do_get_response
http_response = self._send(request)
File "F:\Python\lib\site-packages\botocore\endpoint.py", line 377, in _send
return self.http_session.send(request)
File "F:\Python\lib\site-packages\botocore\httpsession.py", line 484, in send
raise EndpointConnectionError(endpoint_url=request.url, error=e)
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://sts.US.amazonaws.com/"
PS C:\Users\GlowSharpie\Desktop\Python Scripts\Barcode Creation\FBA\SP API>
I have attempted to uninstall all of the site packages thinking that maybe it was a bug of some kind. However this still doesn't fix my issue either. I'm really lost and could use some guidance....
Here is my code putting in "*********" to protect the credentials:
Under the user "SP_API_User" I have the following inline policy for my IAM user:
And under my role "SellingPartnerAPI_Role" is where I Invoke the access with this following Customer managed policy:
I also submitted the application for the refresh token, LWA client ID, and LWA Secret ID on https://sellercentral.amazon.com/sellingpartner/developerconsole/ref=xx_DevCon_dnav_xx where I have the IAM ARN setup for
arn:aws:iam::************:role/SellingPartnerAPI_Role
Any help would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions