Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aiobotocore] Access Denied when calling the ListObjects #1005

Open
akanshi-elastic opened this issue Apr 11, 2023 · 13 comments
Open

[aiobotocore] Access Denied when calling the ListObjects #1005

akanshi-elastic opened this issue Apr 11, 2023 · 13 comments

Comments

@akanshi-elastic
Copy link

akanshi-elastic commented Apr 11, 2023

Requirements

  • Aiobotocore: 2.4.0
  • Python version: 3.10.2
  • Operating System: Linux

Description

I observed that when I create resource using default region which was mentioned in aws configure and try to access(using same resource) a bucket(newly created bucket) in us-west-2 using aiobotocore it gives an error Access denied for few days and then it starts working. Using boto3 it works fine.

Code Snipppet

import asyncio
from aiobotocore.session import get_session

async def go():
    bucket = 'es-ent-2'

    session = get_session()
    async with session.create_client('s3') as client:


        # get object from s3
        response = await client.get_object(Bucket=bucket, Key="50kb-doc (4) (1).paper")
        # this will ensure the connection is correctly re-used/closed
        async with response['Body'] as stream:
            print(await stream.read())

loop = asyncio.get_event_loop()
loop.run_until_complete(go())
/root/sharepoint_auth.py:17: DeprecationWarning: There is no current event loop
  loop = asyncio.get_event_loop()
Traceback (most recent call last):
  File "/root/sharepoint_auth.py", line 18, in <module>
    loop.run_until_complete(go())
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/root/sharepoint_auth.py", line 12, in go
    response = await client.get_object(Bucket=bucket, Key="50kb-doc (4) (1).paper")
  File "/usr/local/lib/python3.10/site-packages/aiobotocore/client.py", line 358, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the GetObject operation: Access Denied
@thehesiod
Copy link
Collaborator

could you try with debug logging enabled?

@akanshi-elastic
Copy link
Author

akanshi-elastic commented Apr 11, 2023

[root@localhost ~]# python3.10 sharepoint_auth.py 
/root/sharepoint_auth.py:22: DeprecationWarning: There is no current event loop
  loop = asyncio.get_event_loop()
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:botocore.hooks:Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
DEBUG:botocore.hooks:Changing event name from before-call.apigateway to before-call.api-gateway
DEBUG:botocore.hooks:Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
DEBUG:botocore.hooks:Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
DEBUG:botocore.hooks:Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
DEBUG:botocore.hooks:Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
DEBUG:botocore.hooks:Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
DEBUG:botocore.hooks:Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
DEBUG:botocore.hooks:Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
DEBUG:botocore.hooks:Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
DEBUG:botocore.hooks:Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
DEBUG:botocore.httpsession:Certificate path: /usr/local/lib/python3.10/site-packages/certifi/cacert.pem
DEBUG:botocore.utils:IMDS ENDPOINT: http://169.254.169.254/
DEBUG:botocore.httpsession:Certificate path: /usr/local/lib/python3.10/site-packages/certifi/cacert.pem
DEBUG:aiobotocore.credentials:Looking for credentials via: env
DEBUG:aiobotocore.credentials:Looking for credentials via: assume-role
DEBUG:aiobotocore.credentials:Looking for credentials via: assume-role-with-web-identity
DEBUG:aiobotocore.credentials:Looking for credentials via: sso
DEBUG:aiobotocore.credentials:Looking for credentials via: shared-credentials-file
INFO:aiobotocore.credentials:Found credentials in shared credentials file: ~/.aws/credentials
DEBUG:botocore.loaders:Loading JSON file: /usr/local/lib/python3.10/site-packages/botocore/data/endpoints.json
DEBUG:botocore.loaders:Loading JSON file: /usr/local/lib/python3.10/site-packages/botocore/data/sdk-default-configuration.json
DEBUG:botocore.hooks:Event choose-service-name: calling handler <function handle_service_name_alias at 0x7fdb2423e830>
DEBUG:botocore.loaders:Loading JSON file: /usr/local/lib/python3.10/site-packages/botocore/data/s3/2006-03-01/service-2.json
DEBUG:botocore.hooks:Event creating-client-class.s3: calling handler <function add_generate_presigned_post at 0x7fdb23370ca0>
DEBUG:botocore.hooks:Event creating-client-class.s3: calling handler <function add_generate_presigned_url at 0x7fdb23370af0>
DEBUG:botocore.endpoint:Setting s3 timeout as (60, 60)
DEBUG:botocore.httpsession:Certificate path: /usr/local/lib/python3.10/site-packages/certifi/cacert.pem
DEBUG:botocore.loaders:Loading JSON file: /usr/local/lib/python3.10/site-packages/botocore/data/_retry.json
DEBUG:botocore.client:Registering retry handlers for service: s3
DEBUG:botocore.hooks:Event before-parameter-build.s3.GetObject: calling handler <function sse_md5 at 0x7fdb24280280>
DEBUG:botocore.hooks:Event before-parameter-build.s3.GetObject: calling handler <function validate_bucket_name at 0x7fdb242801f0>
DEBUG:botocore.hooks:Event before-parameter-build.s3.GetObject: calling handler <bound method S3RegionRedirector.redirect_from_cache of <aiobotocore.utils.AioS3RegionRedirector object at 0x7fdb22b42e90>>
DEBUG:botocore.hooks:Event before-parameter-build.s3.GetObject: calling handler <bound method S3ArnParamHandler.handle_arn of <botocore.utils.S3ArnParamHandler object at 0x7fdb22b42e60>>
DEBUG:botocore.hooks:Event before-parameter-build.s3.GetObject: calling handler <function generate_idempotent_uuid at 0x7fdb24280040>
DEBUG:botocore.hooks:Event before-call.s3.GetObject: calling handler <function add_expect_header at 0x7fdb24280550>
DEBUG:botocore.hooks:Event before-call.s3.GetObject: calling handler <bound method S3RegionRedirector.set_request_url of <aiobotocore.utils.AioS3RegionRedirector object at 0x7fdb22b42e90>>
DEBUG:botocore.hooks:Event before-call.s3.GetObject: calling handler <function add_recursion_detection_header at 0x7fdb242672e0>
DEBUG:botocore.hooks:Event before-call.s3.GetObject: calling handler <function inject_api_version_header_if_needed at 0x7fdb24281870>
DEBUG:botocore.endpoint:Making request for OperationModel(name=GetObject) with params: {'url_path': '/es-ent-02/50kb-doc%20%284%29%20%281%29.paper', 'query_string': {}, 'method': 'GET', 'headers': {'User-Agent': 'Botocore/1.27.59 Python/3.10.2 Linux/4.18.0-425.3.1.el8.x86_64'}, 'body': b'', 'url': 'https://s3.amazonaws.com/es-ent-02/50kb-doc%20%284%29%20%281%29.paper', 'context': {'client_region': 'us-east-1', 'client_config': <aiobotocore.config.AioConfig object at 0x7fdb22b42440>, 'has_streaming_input': False, 'auth_type': None, 'signing': {'bucket': 'es-ent-02'}}}
DEBUG:botocore.hooks:Event request-created.s3.GetObject: calling handler <bound method AioRequestSigner.handler of <aiobotocore.signers.AioRequestSigner object at 0x7fdb22b422f0>>
DEBUG:botocore.hooks:Event choose-signer.s3.GetObject: calling handler <bound method S3EndpointSetter.set_signer of <botocore.utils.S3EndpointSetter object at 0x7fdb22b42f80>>
DEBUG:botocore.hooks:Event choose-signer.s3.GetObject: calling handler <bound method ClientCreator._default_s3_presign_to_sigv2 of <aiobotocore.client.AioClientCreator object at 0x7fdb233b3dc0>>
DEBUG:botocore.hooks:Event choose-signer.s3.GetObject: calling handler <function set_operation_specific_signer at 0x7fdb24267eb0>
DEBUG:botocore.hooks:Event before-sign.s3.GetObject: calling handler <bound method S3EndpointSetter.set_endpoint of <botocore.utils.S3EndpointSetter object at 0x7fdb22b42f80>>
DEBUG:botocore.utils:Defaulting to S3 virtual host style addressing with path style addressing fallback.
DEBUG:botocore.utils:Checking for DNS compatible bucket for: https://s3.amazonaws.com/es-ent-02/50kb-doc%20%284%29%20%281%29.paper
DEBUG:botocore.utils:URI updated to: https://es-ent-02.s3.amazonaws.com/50kb-doc%20%284%29%20%281%29.paper
DEBUG:botocore.auth:Calculating signature using v4 auth.
DEBUG:botocore.auth:CanonicalRequest:
GET
/50kb-doc%20%284%29%20%281%29.paper

host:es-ent-02.s3.amazonaws.com
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20230411T063023Z

host;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
DEBUG:botocore.auth:StringToSign:
AWS4-HMAC-SHA256
20230411T063023Z
20230411/us-east-1/s3/aws4_request
3da391c380543efe355687d4f5007e20dcb23dc8b98cde630f69639108954b4c
DEBUG:botocore.auth:Signature:
551cbe589b8732f4ba642eb66aec456a41abab87b2de177ea426441177a06bec
DEBUG:botocore.hooks:Event request-created.s3.GetObject: calling handler <function add_retry_headers at 0x7fdb24281f30>
DEBUG:botocore.endpoint:Sending http request: <AWSPreparedRequest stream_output=True, method=GET, url=https://es-ent-02.s3.amazonaws.com/50kb-doc%20%284%29%20%281%29.paper, headers={'User-Agent': b'Botocore/1.27.59 Python/3.10.2 Linux/4.18.0-425.3.1.el8.x86_64', 'X-Amz-Date': b'20230411T063023Z', 'X-Amz-Content-SHA256': b'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'Authorization': b'AWS4-HMAC-SHA256 Credential=AKIA2LFES46YKSIDLUYG/20230411/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=551cbe589b8732f4ba642eb66aec456a41abab87b2de177ea426441177a06bec', 'amz-sdk-invocation-id': b'd7b07580-2b4b-4b11-8711-784952aa049e', 'amz-sdk-request': b'attempt=1'}>
DEBUG:botocore.parsers:Response headers: HTTPHeaderDict({'x-amz-request-id': 'KJJ3HX19MCK7MKPF', 'x-amz-id-2': 'PpOlQH8vqnKU6Ku0/NXBl+E1lW8TpE/kv0+9c8FcpApsnh0dnlzxfvtIB38S0yIp/R1dRaKwjWs=', 'content-type': 'application/xml', 'transfer-encoding': 'chunked', 'date': 'Tue, 11 Apr 2023 06:30:25 GMT', 'server': 'AmazonS3'})
DEBUG:botocore.parsers:Response body:
b'<?xml version="1.0" encoding="UTF-8"?>\n<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>KJJ3HX19MCK7MKPF</RequestId><HostId>PpOlQH8vqnKU6Ku0/NXBl+E1lW8TpE/kv0+9c8FcpApsnh0dnlzxfvtIB38S0yIp/R1dRaKwjWs=</HostId></Error>'
DEBUG:botocore.hooks:Event needs-retry.s3.GetObject: calling handler <aiobotocore.retryhandler.AioRetryHandler object at 0x7fdb22b42dd0>
DEBUG:botocore.retryhandler:No retry needed.
DEBUG:botocore.hooks:Event needs-retry.s3.GetObject: calling handler <bound method AioS3RegionRedirector.redirect_from_error of <aiobotocore.utils.AioS3RegionRedirector object at 0x7fdb22b42e90>>
Traceback (most recent call last):
  File "/root/sharepoint_auth.py", line 23, in <module>
    loop.run_until_complete(go())
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/root/sharepoint_auth.py", line 17, in go
    response = await client.get_object(Bucket=bucket, Key="50kb-doc (4) (1).paper")
  File "/usr/local/lib/python3.10/site-packages/aiobotocore/client.py", line 358, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the GetObject operation: Access Denied

@akanshi-elastic
Copy link
Author

These all logs are showing when enabling the DEBUG in the code snippet.

@thehesiod
Copy link
Collaborator

interesting, not anything obviously wrong. Could you do a comparison debug output using botocore? That may shed some light.

@akanshi-elastic
Copy link
Author

Using boto3 I am able to get the bucket objects:

boto3.set_stream_logger('botocore', level=logging.DEBUG)
s3 = boto3.client('s3', aws_access_key_id="accesskey", aws_secret_access_key= "secretkey")
response = s3.list_objects_v2(Bucket='es-ent-03')
2023-04-12 10:46:47,379 botocore.hooks [DEBUG] Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2023-04-12 10:46:47,383 botocore.hooks [DEBUG] Changing event name from before-call.apigateway to before-call.api-gateway
2023-04-12 10:46:47,384 botocore.hooks [DEBUG] Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2023-04-12 10:46:47,387 botocore.hooks [DEBUG] Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2023-04-12 10:46:47,387 botocore.hooks [DEBUG] Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2023-04-12 10:46:47,388 botocore.hooks [DEBUG] Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2023-04-12 10:46:47,389 botocore.hooks [DEBUG] Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2023-04-12 10:46:47,394 botocore.hooks [DEBUG] Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2023-04-12 10:46:47,394 botocore.hooks [DEBUG] Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2023-04-12 10:46:47,394 botocore.hooks [DEBUG] Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2023-04-12 10:46:47,394 botocore.hooks [DEBUG] Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2023-04-12 10:46:47,398 botocore.loaders [DEBUG] Loading JSON file: /usr/local/lib/python3.10/site-packages/botocore/data/endpoints.json
2023-04-12 10:46:47,431 botocore.loaders [DEBUG] Loading JSON file: /usr/local/lib/python3.10/site-packages/botocore/data/sdk-default-configuration.json
2023-04-12 10:46:47,431 botocore.hooks [DEBUG] Event choose-service-name: calling handler <function handle_service_name_alias at 0x7f84c3646a70>
2023-04-12 10:46:47,453 botocore.loaders [DEBUG] Loading JSON file: /usr/local/lib/python3.10/site-packages/botocore/data/s3/2006-03-01/service-2.json
2023-04-12 10:46:47,469 botocore.hooks [DEBUG] Event creating-client-class.s3: calling handler <function add_generate_presigned_post at 0x7f84c35f8790>
2023-04-12 10:46:47,469 botocore.hooks [DEBUG] Event creating-client-class.s3: calling handler <function lazy_call.<locals>._handler at 0x7f84d745fd90>
2023-04-12 10:46:47,495 botocore.hooks [DEBUG] Event creating-client-class.s3: calling handler <function add_generate_presigned_url at 0x7f84c35f8550>
2023-04-12 10:46:47,498 botocore.endpoint [DEBUG] Setting s3 timeout as (60, 60)
2023-04-12 10:46:47,502 botocore.loaders [DEBUG] Loading JSON file: /usr/local/lib/python3.10/site-packages/botocore/data/_retry.json
2023-04-12 10:46:47,502 botocore.client [DEBUG] Registering retry handlers for service: s3
2023-04-12 10:46:47,505 botocore.hooks [DEBUG] Event before-parameter-build.s3.ListObjectsV2: calling handler <function set_list_objects_encoding_type_url at 0x7f84c366da20>
2023-04-12 10:46:47,505 botocore.hooks [DEBUG] Event before-parameter-build.s3.ListObjectsV2: calling handler <function validate_bucket_name at 0x7f84c366c790>
2023-04-12 10:46:47,505 botocore.hooks [DEBUG] Event before-parameter-build.s3.ListObjectsV2: calling handler <bound method S3RegionRedirector.redirect_from_cache of <botocore.utils.S3RegionRedirector object at 0x7f84c19dd9f0>>
2023-04-12 10:46:47,505 botocore.hooks [DEBUG] Event before-parameter-build.s3.ListObjectsV2: calling handler <bound method S3ArnParamHandler.handle_arn of <botocore.utils.S3ArnParamHandler object at 0x7f84c19dd9c0>>
2023-04-12 10:46:47,505 botocore.hooks [DEBUG] Event before-parameter-build.s3.ListObjectsV2: calling handler <function generate_idempotent_uuid at 0x7f84c366c5e0>
2023-04-12 10:46:47,506 botocore.hooks [DEBUG] Event before-call.s3.ListObjectsV2: calling handler <function add_expect_header at 0x7f84c366caf0>
2023-04-12 10:46:47,506 botocore.hooks [DEBUG] Event before-call.s3.ListObjectsV2: calling handler <bound method S3RegionRedirector.set_request_url of <botocore.utils.S3RegionRedirector object at 0x7f84c19dd9f0>>
2023-04-12 10:46:47,506 botocore.hooks [DEBUG] Event before-call.s3.ListObjectsV2: calling handler <function add_recursion_detection_header at 0x7f84c366c280>
2023-04-12 10:46:47,506 botocore.hooks [DEBUG] Event before-call.s3.ListObjectsV2: calling handler <function inject_api_version_header_if_needed at 0x7f84c366de10>
2023-04-12 10:46:47,506 botocore.endpoint [DEBUG] Making request for OperationModel(name=ListObjectsV2) with params: {'url_path': '/es-ent-03?list-type=2', 'query_string': {'encoding-type': 'url'}, 'method': 'GET', 'headers': {'User-Agent': 'Boto3/1.21.21 Python/3.10.2 Linux/4.18.0-425.3.1.el8.x86_64 Botocore/1.24.21'}, 'body': b'', 'url': 'https://s3.amazonaws.com/es-ent-03?list-type=2&encoding-type=url', 'context': {'client_region': 'us-east-1', 'client_config': <botocore.config.Config object at 0x7f84c19dce80>, 'has_streaming_input': False, 'auth_type': None, 'encoding_type_auto_set': True, 'signing': {'bucket': 'es-ent-03'}}}
2023-04-12 10:46:47,507 botocore.hooks [DEBUG] Event request-created.s3.ListObjectsV2: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x7f84c20ee500>>
2023-04-12 10:46:47,507 botocore.hooks [DEBUG] Event choose-signer.s3.ListObjectsV2: calling handler <bound method S3EndpointSetter.set_signer of <botocore.utils.S3EndpointSetter object at 0x7f84c19ddae0>>
2023-04-12 10:46:47,507 botocore.hooks [DEBUG] Event choose-signer.s3.ListObjectsV2: calling handler <bound method ClientCreator._default_s3_presign_to_sigv2 of <botocore.client.ClientCreator object at 0x7f84c29a4850>>
2023-04-12 10:46:47,507 botocore.hooks [DEBUG] Event choose-signer.s3.ListObjectsV2: calling handler <function set_operation_specific_signer at 0x7f84c366c4c0>
2023-04-12 10:46:47,508 botocore.hooks [DEBUG] Event before-sign.s3.ListObjectsV2: calling handler <bound method S3EndpointSetter.set_endpoint of <botocore.utils.S3EndpointSetter object at 0x7f84c19ddae0>>
2023-04-12 10:46:47,508 botocore.utils [DEBUG] Defaulting to S3 virtual host style addressing with path style addressing fallback.
2023-04-12 10:46:47,508 botocore.utils [DEBUG] Checking for DNS compatible bucket for: https://s3.amazonaws.com/es-ent-03?list-type=2&encoding-type=url
2023-04-12 10:46:47,508 botocore.utils [DEBUG] URI updated to: https://es-ent-03.s3.amazonaws.com/?list-type=2&encoding-type=url
2023-04-12 10:46:47,508 botocore.auth [DEBUG] Calculating signature using v4 auth.
2023-04-12 10:46:47,509 botocore.auth [DEBUG] CanonicalRequest:
GET
/
encoding-type=url&list-type=2
host:es-ent-03.s3.amazonaws.com
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20230412T144647Z

host;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
2023-04-12 10:46:47,509 botocore.auth [DEBUG] StringToSign:
AWS4-HMAC-SHA256
20230412T144647Z
20230412/us-east-1/s3/aws4_request
11f683e451692eb1ddd709f545cc5bb8ce417873f76a671b64c1cd35f2de0b7f
2023-04-12 10:46:47,509 botocore.auth [DEBUG] Signature:
d7c458b0c3b7ca7e1b5011342dcf9f5c4246fafcaa6a3d36b1961b75d3dcba66
2023-04-12 10:46:47,509 botocore.hooks [DEBUG] Event request-created.s3.ListObjectsV2: calling handler <function add_retry_headers at 0x7f84c366e4d0>
2023-04-12 10:46:47,509 botocore.endpoint [DEBUG] Sending http request: <AWSPreparedRequest stream_output=False, method=GET, url=https://es-ent-03.s3.amazonaws.com/?list-type=2&encoding-type=url, headers={'User-Agent': b'Boto3/1.21.21 Python/3.10.2 Linux/4.18.0-425.3.1.el8.x86_64 Botocore/1.24.21', 'X-Amz-Date': b'20230412T144647Z', 'X-Amz-Content-SHA256': b'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'Authorization': b'AWS4-HMAC-SHA256 Credential=AKIA2LFES46YDJA66QRV/20230412/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=d7c458b0c3b7ca7e1b5011342dcf9f5c4246fafcaa6a3d36b1961b75d3dcba66', 'amz-sdk-invocation-id': b'055c1365-e735-4fc4-a79a-206dfca2c02e', 'amz-sdk-request': b'attempt=1'}>
2023-04-12 10:46:47,512 botocore.httpsession [DEBUG] Certificate path: /usr/local/lib/python3.10/site-packages/certifi/cacert.pem
2023-04-12 10:46:48,312 botocore.parsers [DEBUG] Response headers: {'x-amz-bucket-region': 'ap-northeast-1', 'x-amz-request-id': 'H8ESP7V3WJER6KYA', 'x-amz-id-2': 'SXoKNgExNKkM5zmR+fTgBur9dzcgLoMB0gstkqtteLqkzv67m/ae4A0dDOmNvL9ky92gxzEtvbI=', 'Location': 'https://es-ent-03.s3-ap-northeast-1.amazonaws.com/?list-type=2&encoding-type=url', 'Content-Type': 'application/xml', 'Transfer-Encoding': 'chunked', 'Date': 'Wed, 12 Apr 2023 14:46:47 GMT', 'Server': 'AmazonS3'}
2023-04-12 10:46:48,312 botocore.parsers [DEBUG] Response body:
b'<?xml version="1.0" encoding="UTF-8"?>\n<Error><Code>TemporaryRedirect</Code><Message>Please re-send this request to the specified temporary endpoint. Continue to use the original request endpoint for future requests.</Message><Endpoint>es-ent-03.s3-ap-northeast-1.amazonaws.com</Endpoint><Bucket>es-ent-03</Bucket><RequestId>H8ESP7V3WJER6KYA</RequestId><HostId>SXoKNgExNKkM5zmR+fTgBur9dzcgLoMB0gstkqtteLqkzv67m/ae4A0dDOmNvL9ky92gxzEtvbI=</HostId></Error>'
2023-04-12 10:46:48,316 botocore.hooks [DEBUG] Event needs-retry.s3.ListObjectsV2: calling handler <botocore.retryhandler.RetryHandler object at 0x7f84c19dd930>
2023-04-12 10:46:48,316 botocore.retryhandler [DEBUG] No retry needed.
2023-04-12 10:46:48,316 botocore.hooks [DEBUG] Event needs-retry.s3.ListObjectsV2: calling handler <bound method S3RegionRedirector.redirect_from_error of <botocore.utils.S3RegionRedirector object at 0x7f84c19dd9f0>>
2023-04-12 10:46:48,317 botocore.utils [DEBUG] S3 client configured for region us-east-1 but the bucket es-ent-03 is in region ap-northeast-1; Please configure the proper region to avoid multiple unnecessary redirects and signing attempts.
2023-04-12 10:46:48,317 botocore.utils [DEBUG] Updating URI from https://s3.amazonaws.com/es-ent-03?list-type=2&encoding-type=url to https://s3.ap-northeast-1.amazonaws.com/es-ent-03?list-type=2&encoding-type=url
2023-04-12 10:46:48,317 botocore.endpoint [DEBUG] Response received to retry, sleeping for 0 seconds
2023-04-12 10:46:48,321 botocore.hooks [DEBUG] Event request-created.s3.ListObjectsV2: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x7f84c20ee500>>
2023-04-12 10:46:48,321 botocore.hooks [DEBUG] Event choose-signer.s3.ListObjectsV2: calling handler <bound method S3EndpointSetter.set_signer of <botocore.utils.S3EndpointSetter object at 0x7f84c19ddae0>>
2023-04-12 10:46:48,321 botocore.hooks [DEBUG] Event choose-signer.s3.ListObjectsV2: calling handler <bound method ClientCreator._default_s3_presign_to_sigv2 of <botocore.client.ClientCreator object at 0x7f84c29a4850>>
2023-04-12 10:46:48,321 botocore.hooks [DEBUG] Event choose-signer.s3.ListObjectsV2: calling handler <function set_operation_specific_signer at 0x7f84c366c4c0>
2023-04-12 10:46:48,321 botocore.hooks [DEBUG] Event before-sign.s3.ListObjectsV2: calling handler <bound method S3EndpointSetter.set_endpoint of <botocore.utils.S3EndpointSetter object at 0x7f84c19ddae0>>
2023-04-12 10:46:48,322 botocore.utils [DEBUG] Checking for DNS compatible bucket for: https://s3.ap-northeast-1.amazonaws.com/es-ent-03?list-type=2&encoding-type=url
2023-04-12 10:46:48,322 botocore.utils [DEBUG] URI updated to: https://es-ent-03.s3.ap-northeast-1.amazonaws.com/?list-type=2&encoding-type=url
2023-04-12 10:46:48,322 botocore.auth [DEBUG] Calculating signature using v4 auth.
2023-04-12 10:46:48,322 botocore.auth [DEBUG] CanonicalRequest:
GET
/
encoding-type=url&list-type=2
host:es-ent-03.s3.ap-northeast-1.amazonaws.com
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20230412T144648Z

host;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
2023-04-12 10:46:48,322 botocore.auth [DEBUG] StringToSign:
AWS4-HMAC-SHA256
20230412T144648Z
20230412/ap-northeast-1/s3/aws4_request
df2d0d9b8b6e4e83d8e6e231ffc251935d0129475302d953bfb7a926e6363582
2023-04-12 10:46:48,323 botocore.auth [DEBUG] Signature:
a050d58a88c80d1632178b25c2b387876774978428fcd402eaaa4695dff4da62
2023-04-12 10:46:48,324 botocore.hooks [DEBUG] Event request-created.s3.ListObjectsV2: calling handler <function add_retry_headers at 0x7f84c366e4d0>
2023-04-12 10:46:48,324 botocore.endpoint [DEBUG] Sending http request: <AWSPreparedRequest stream_output=False, method=GET, url=https://es-ent-03.s3.ap-northeast-1.amazonaws.com/?list-type=2&encoding-type=url, headers={'User-Agent': b'Boto3/1.21.21 Python/3.10.2 Linux/4.18.0-425.3.1.el8.x86_64 Botocore/1.24.21', 'X-Amz-Date': b'20230412T144648Z', 'X-Amz-Content-SHA256': b'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'Authorization': b'AWS4-HMAC-SHA256 Credential=AKIA2LFES46YDJA66QRV/20230412/ap-northeast-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=a050d58a88c80d1632178b25c2b387876774978428fcd402eaaa4695dff4da62', 'amz-sdk-invocation-id': b'055c1365-e735-4fc4-a79a-206dfca2c02e', 'amz-sdk-request': b'ttl=20230412T144747Z; attempt=2; max=5'}>
2023-04-12 10:46:48,324 botocore.httpsession [DEBUG] Certificate path: /usr/local/lib/python3.10/site-packages/certifi/cacert.pem
2023-04-12 10:46:49,471 botocore.parsers [DEBUG] Response headers: {'x-amz-id-2': 'gzwGd8fdwSnZ8kHxPdoCtchiWPlpTVdB5zcEYBlTxrSmJj0VwaHWE5mDOnj3l+L+pJbnsDv5PRs=', 'x-amz-request-id': '55Q82FM9ZBY0S4ZW', 'Date': 'Wed, 12 Apr 2023 14:46:50 GMT', 'x-amz-bucket-region': 'ap-northeast-1', 'Content-Type': 'application/xml', 'Transfer-Encoding': 'chunked', 'Server': 'AmazonS3'}
2023-04-12 10:46:49,471 botocore.parsers [DEBUG] Response body:
b'<?xml version="1.0" encoding="UTF-8"?>\n<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Name>es-ent-03</Name><Prefix></Prefix><KeyCount>1</KeyCount><MaxKeys>1000</MaxKeys><EncodingType>url</EncodingType><IsTruncated>false</IsTruncated><Contents><Key>50kb-doc+%284%29+%281%29.paper</Key><LastModified>2023-04-12T14:39:37.000Z</LastModified><ETag>&quot;f2974b114cba136bda15adb90f189e29&quot;</ETag><Size>60275</Size><StorageClass>STANDARD</StorageClass></Contents></ListBucketResult>'
2023-04-12 10:46:49,472 botocore.hooks [DEBUG] Event needs-retry.s3.ListObjectsV2: calling handler <botocore.retryhandler.RetryHandler object at 0x7f84c19dd930>
2023-04-12 10:46:49,472 botocore.retryhandler [DEBUG] No retry needed.
2023-04-12 10:46:49,472 botocore.hooks [DEBUG] Event needs-retry.s3.ListObjectsV2: calling handler <bound method S3RegionRedirector.redirect_from_error of <botocore.utils.S3RegionRedirector object at 0x7f84c19dd9f0>>
2023-04-12 10:46:49,472 botocore.utils [DEBUG] S3 request was previously redirected, not redirecting.
2023-04-12 10:46:49,473 botocore.hooks [DEBUG] Event after-call.s3.ListObjectsV2: calling handler <function decode_list_object_v2 at 0x7f84c366db40>
50kb-doc (4) (1).paper

@akanshi-elastic
Copy link
Author

And the interesting thing is that the same objects for which I am getting error right now, it works fine with same code after one day.

@thehesiod
Copy link
Collaborator

i was curious more of using raw botocore, not boto3 for a cleaner log comparison

@akanshi-elastic
Copy link
Author

With botocore I am able to access the bucket objects ..

boto3.set_stream_logger()
boto3.set_stream_logger("botocore")
session = botocore.session.get_session()
client = session.create_client('s3',aws_access_key_id="", aws_secret_access_key="")
print(client.list_objects(Bucket='es-ent-05'))

Here is the log:

2023-04-14 03:06:46,872 botocore.hooks [DEBUG] Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2023-04-14 03:06:46,875 botocore.hooks [DEBUG] Changing event name from before-call.apigateway to before-call.api-gateway
2023-04-14 03:06:46,877 botocore.hooks [DEBUG] Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2023-04-14 03:06:46,879 botocore.hooks [DEBUG] Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2023-04-14 03:06:46,879 botocore.hooks [DEBUG] Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2023-04-14 03:06:46,880 botocore.hooks [DEBUG] Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2023-04-14 03:06:46,882 botocore.hooks [DEBUG] Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2023-04-14 03:06:46,886 botocore.hooks [DEBUG] Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2023-04-14 03:06:46,887 botocore.hooks [DEBUG] Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2023-04-14 03:06:46,887 botocore.hooks [DEBUG] Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2023-04-14 03:06:46,887 botocore.hooks [DEBUG] Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2023-04-14 03:06:46,889 botocore.loaders [DEBUG] Loading JSON file: /usr/local/lib/python3.10/site-packages/botocore/data/endpoints.json
2023-04-14 03:06:46,923 botocore.loaders [DEBUG] Loading JSON file: /usr/local/lib/python3.10/site-packages/botocore/data/sdk-default-configuration.json
2023-04-14 03:06:46,923 botocore.hooks [DEBUG] Event choose-service-name: calling handler <function handle_service_name_alias at 0x7fecca2329e0>
2023-04-14 03:06:46,945 botocore.loaders [DEBUG] Loading JSON file: /usr/local/lib/python3.10/site-packages/botocore/data/s3/2006-03-01/service-2.json
2023-04-14 03:06:46,961 botocore.hooks [DEBUG] Event creating-client-class.s3: calling handler <function add_generate_presigned_post at 0x7fecca1e4700>
2023-04-14 03:06:46,961 botocore.hooks [DEBUG] Event creating-client-class.s3: calling handler <function add_generate_presigned_url at 0x7fecca1e44c0>
2023-04-14 03:06:46,965 botocore.endpoint [DEBUG] Setting s3 timeout as (60, 60)
2023-04-14 03:06:46,968 botocore.loaders [DEBUG] Loading JSON file: /usr/local/lib/python3.10/site-packages/botocore/data/_retry.json
2023-04-14 03:06:46,969 botocore.client [DEBUG] Registering retry handlers for service: s3
2023-04-14 03:06:46,971 botocore.hooks [DEBUG] Event before-parameter-build.s3.ListObjects: calling handler <function set_list_objects_encoding_type_url at 0x7fecca259990>
2023-04-14 03:06:46,971 botocore.hooks [DEBUG] Event before-parameter-build.s3.ListObjects: calling handler <function validate_bucket_name at 0x7fecca258700>
2023-04-14 03:06:46,971 botocore.hooks [DEBUG] Event before-parameter-build.s3.ListObjects: calling handler <bound method S3RegionRedirector.redirect_from_cache of <botocore.utils.S3RegionRedirector object at 0x7fecc8ec2bf0>>
2023-04-14 03:06:46,971 botocore.hooks [DEBUG] Event before-parameter-build.s3.ListObjects: calling handler <bound method S3ArnParamHandler.handle_arn of <botocore.utils.S3ArnParamHandler object at 0x7fecc8ec2bc0>>
2023-04-14 03:06:46,971 botocore.hooks [DEBUG] Event before-parameter-build.s3.ListObjects: calling handler <function generate_idempotent_uuid at 0x7fecca258550>
2023-04-14 03:06:46,972 botocore.hooks [DEBUG] Event before-call.s3.ListObjects: calling handler <function add_expect_header at 0x7fecca258a60>
2023-04-14 03:06:46,972 botocore.hooks [DEBUG] Event before-call.s3.ListObjects: calling handler <bound method S3RegionRedirector.set_request_url of <botocore.utils.S3RegionRedirector object at 0x7fecc8ec2bf0>>
2023-04-14 03:06:46,972 botocore.hooks [DEBUG] Event before-call.s3.ListObjects: calling handler <function add_recursion_detection_header at 0x7fecca2581f0>
2023-04-14 03:06:46,972 botocore.hooks [DEBUG] Event before-call.s3.ListObjects: calling handler <function inject_api_version_header_if_needed at 0x7fecca259d80>
2023-04-14 03:06:46,972 botocore.endpoint [DEBUG] Making request for OperationModel(name=ListObjects) with params: {'url_path': '/es-ent-05', 'query_string': {'encoding-type': 'url'}, 'method': 'GET', 'headers': {'User-Agent': 'Botocore/1.24.21 Python/3.10.2 Linux/4.18.0-425.3.1.el8.x86_64'}, 'body': b'', 'url': 'https://s3.amazonaws.com/es-ent-05?encoding-type=url', 'context': {'client_region': 'us-east-1', 'client_config': <botocore.config.Config object at 0x7fecc8ec2140>, 'has_streaming_input': False, 'auth_type': None, 'encoding_type_auto_set': True, 'signing': {'bucket': 'es-ent-05'}}}
2023-04-14 03:06:46,973 botocore.hooks [DEBUG] Event request-created.s3.ListObjects: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x7fecc8ec1ff0>>
2023-04-14 03:06:46,975 botocore.hooks [DEBUG] Event choose-signer.s3.ListObjects: calling handler <bound method S3EndpointSetter.set_signer of <botocore.utils.S3EndpointSetter object at 0x7fecc8ec2ce0>>
2023-04-14 03:06:46,975 botocore.hooks [DEBUG] Event choose-signer.s3.ListObjects: calling handler <bound method ClientCreator._default_s3_presign_to_sigv2 of <botocore.client.ClientCreator object at 0x7fecca265360>>
2023-04-14 03:06:46,975 botocore.hooks [DEBUG] Event choose-signer.s3.ListObjects: calling handler <function set_operation_specific_signer at 0x7fecca258430>
2023-04-14 03:06:46,975 botocore.hooks [DEBUG] Event before-sign.s3.ListObjects: calling handler <bound method S3EndpointSetter.set_endpoint of <botocore.utils.S3EndpointSetter object at 0x7fecc8ec2ce0>>
2023-04-14 03:06:46,975 botocore.utils [DEBUG] Defaulting to S3 virtual host style addressing with path style addressing fallback.
2023-04-14 03:06:46,976 botocore.utils [DEBUG] Checking for DNS compatible bucket for: https://s3.amazonaws.com/es-ent-05?encoding-type=url
2023-04-14 03:06:46,976 botocore.utils [DEBUG] URI updated to: https://es-ent-05.s3.amazonaws.com/?encoding-type=url
2023-04-14 03:06:46,976 botocore.auth [DEBUG] Calculating signature using v4 auth.
2023-04-14 03:06:46,976 botocore.auth [DEBUG] CanonicalRequest:
GET
/
encoding-type=url
host:es-ent-05.s3.amazonaws.com
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20230414T070646Z

host;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
2023-04-14 03:06:46,976 botocore.auth [DEBUG] StringToSign:
AWS4-HMAC-SHA256
20230414T070646Z
20230414/us-east-1/s3/aws4_request
fd4604b62528317a8c2edf5c4d1c4943e62529084a782bfe289ec805e8fef26c
2023-04-14 03:06:46,977 botocore.auth [DEBUG] Signature:
0f4057bedf3cd94d5ef75225f79132ffc4759e4f9d7a77044bb0430e6cc0f70e
2023-04-14 03:06:46,977 botocore.hooks [DEBUG] Event request-created.s3.ListObjects: calling handler <function add_retry_headers at 0x7fecca25a440>
2023-04-14 03:06:46,977 botocore.endpoint [DEBUG] Sending http request: <AWSPreparedRequest stream_output=False, method=GET, url=https://es-ent-05.s3.amazonaws.com/?encoding-type=url, headers={'User-Agent': b'Botocore/1.24.21 Python/3.10.2 Linux/4.18.0-425.3.1.el8.x86_64', 'X-Amz-Date': b'20230414T070646Z', 'X-Amz-Content-SHA256': b'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'Authorization': b'AWS4-HMAC-SHA256 Credential=AKIA2LFES46YDJA66QRV/20230414/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=0f4057bedf3cd94d5ef75225f79132ffc4759e4f9d7a77044bb0430e6cc0f70e', 'amz-sdk-invocation-id': b'0db91144-4033-4abb-bbab-a40c7118c01c', 'amz-sdk-request': b'attempt=1'}>
2023-04-14 03:06:46,980 botocore.httpsession [DEBUG] Certificate path: /usr/local/lib/python3.10/site-packages/certifi/cacert.pem
2023-04-14 03:06:47,818 botocore.parsers [DEBUG] Response headers: {'x-amz-bucket-region': 'us-west-1', 'x-amz-request-id': '6810D88RVWAZXKYW', 'x-amz-id-2': '58BC8M/SsSwI+F9hrQGte81txONA89ToxzQoH133JftRHEjI0+ZDfHlJ7NV7RQq6PlqPyZrVVIg=', 'Location': 'https://es-ent-05.s3-us-west-1.amazonaws.com/?encoding-type=url', 'Content-Type': 'application/xml', 'Transfer-Encoding': 'chunked', 'Date': 'Fri, 14 Apr 2023 07:06:46 GMT', 'Server': 'AmazonS3'}
2023-04-14 03:06:47,818 botocore.parsers [DEBUG] Response body:
b'<?xml version="1.0" encoding="UTF-8"?>\n<Error><Code>TemporaryRedirect</Code><Message>Please re-send this request to the specified temporary endpoint. Continue to use the original request endpoint for future requests.</Message><Endpoint>es-ent-05.s3-us-west-1.amazonaws.com</Endpoint><Bucket>es-ent-05</Bucket><RequestId>6810D88RVWAZXKYW</RequestId><HostId>58BC8M/SsSwI+F9hrQGte81txONA89ToxzQoH133JftRHEjI0+ZDfHlJ7NV7RQq6PlqPyZrVVIg=</HostId></Error>'
2023-04-14 03:06:47,822 botocore.hooks [DEBUG] Event needs-retry.s3.ListObjects: calling handler <botocore.retryhandler.RetryHandler object at 0x7fecc8ec2b30>
2023-04-14 03:06:47,822 botocore.retryhandler [DEBUG] No retry needed.
2023-04-14 03:06:47,823 botocore.hooks [DEBUG] Event needs-retry.s3.ListObjects: calling handler <bound method S3RegionRedirector.redirect_from_error of <botocore.utils.S3RegionRedirector object at 0x7fecc8ec2bf0>>
2023-04-14 03:06:47,823 botocore.utils [DEBUG] S3 client configured for region us-east-1 but the bucket es-ent-05 is in region us-west-1; Please configure the proper region to avoid multiple unnecessary redirects and signing attempts.
2023-04-14 03:06:47,823 botocore.utils [DEBUG] Updating URI from https://s3.amazonaws.com/es-ent-05?encoding-type=url to https://s3.us-west-1.amazonaws.com/es-ent-05?encoding-type=url
2023-04-14 03:06:47,823 botocore.endpoint [DEBUG] Response received to retry, sleeping for 0 seconds
2023-04-14 03:06:47,827 botocore.hooks [DEBUG] Event request-created.s3.ListObjects: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x7fecc8ec1ff0>>
2023-04-14 03:06:47,827 botocore.hooks [DEBUG] Event choose-signer.s3.ListObjects: calling handler <bound method S3EndpointSetter.set_signer of <botocore.utils.S3EndpointSetter object at 0x7fecc8ec2ce0>>
2023-04-14 03:06:47,827 botocore.hooks [DEBUG] Event choose-signer.s3.ListObjects: calling handler <bound method ClientCreator._default_s3_presign_to_sigv2 of <botocore.client.ClientCreator object at 0x7fecca265360>>
2023-04-14 03:06:47,827 botocore.hooks [DEBUG] Event choose-signer.s3.ListObjects: calling handler <function set_operation_specific_signer at 0x7fecca258430>
2023-04-14 03:06:47,827 botocore.hooks [DEBUG] Event before-sign.s3.ListObjects: calling handler <bound method S3EndpointSetter.set_endpoint of <botocore.utils.S3EndpointSetter object at 0x7fecc8ec2ce0>>
2023-04-14 03:06:47,828 botocore.utils [DEBUG] Checking for DNS compatible bucket for: https://s3.us-west-1.amazonaws.com/es-ent-05?encoding-type=url
2023-04-14 03:06:47,828 botocore.utils [DEBUG] URI updated to: https://es-ent-05.s3.us-west-1.amazonaws.com/?encoding-type=url
2023-04-14 03:06:47,828 botocore.auth [DEBUG] Calculating signature using v4 auth.
2023-04-14 03:06:47,828 botocore.auth [DEBUG] CanonicalRequest:
GET
/
encoding-type=url
host:es-ent-05.s3.us-west-1.amazonaws.com
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20230414T070647Z

host;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
2023-04-14 03:06:47,828 botocore.auth [DEBUG] StringToSign:
AWS4-HMAC-SHA256
20230414T070647Z
20230414/us-west-1/s3/aws4_request
d83a51278a51c55c554e8ce64e70216b941e0b1d66f0a06b52cd4cdf3905ff6a
2023-04-14 03:06:47,829 botocore.auth [DEBUG] Signature:
262dbe8de590de413e7233b67cfc935d91dd62409a0ba4dd0a57b85398fd4190
2023-04-14 03:06:47,829 botocore.hooks [DEBUG] Event request-created.s3.ListObjects: calling handler <function add_retry_headers at 0x7fecca25a440>
2023-04-14 03:06:47,829 botocore.endpoint [DEBUG] Sending http request: <AWSPreparedRequest stream_output=False, method=GET, url=https://es-ent-05.s3.us-west-1.amazonaws.com/?encoding-type=url, headers={'User-Agent': b'Botocore/1.24.21 Python/3.10.2 Linux/4.18.0-425.3.1.el8.x86_64', 'X-Amz-Date': b'20230414T070647Z', 'X-Amz-Content-SHA256': b'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'Authorization': b'AWS4-HMAC-SHA256 Credential=AKIA2LFES46YDJA66QRV/20230414/us-west-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=262dbe8de590de413e7233b67cfc935d91dd62409a0ba4dd0a57b85398fd4190', 'amz-sdk-invocation-id': b'0db91144-4033-4abb-bbab-a40c7118c01c', 'amz-sdk-request': b'ttl=20230414T070746Z; attempt=2; max=5'}>
2023-04-14 03:06:47,829 botocore.httpsession [DEBUG] Certificate path: /usr/local/lib/python3.10/site-packages/certifi/cacert.pem
2023-04-14 03:06:49,003 botocore.parsers [DEBUG] Response headers: {'x-amz-id-2': 'aNWOdaUvWbiLVnqtV/Wu0L7I7hmWisf63zEMwaumxG83JcP5XVb1K63fCqhnx+AWmSbqmHQy7/c=', 'x-amz-request-id': '0P2GPVZGAEEYZ02V', 'Date': 'Fri, 14 Apr 2023 07:06:49 GMT', 'x-amz-bucket-region': 'us-west-1', 'Content-Type': 'application/xml', 'Transfer-Encoding': 'chunked', 'Server': 'AmazonS3'}
2023-04-14 03:06:49,003 botocore.parsers [DEBUG] Response body:
b'<?xml version="1.0" encoding="UTF-8"?>\n<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Name>es-ent-05</Name><Prefix></Prefix><Marker></Marker><MaxKeys>1000</MaxKeys><EncodingType>url</EncodingType><IsTruncated>false</IsTruncated><Contents><Key>50kb-doc+%283%29+%281%29.paper</Key><LastModified>2023-04-14T07:04:02.000Z</LastModified><ETag>&quot;f2974b114cba136bda15adb90f189e29&quot;</ETag><Size>60275</Size><Owner><ID>1ec213dd8ce39db5ea8da3d6552449effacee6337758d64dff989f85018307b1</ID><DisplayName>crest.it</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents></ListBucketResult>'
2023-04-14 03:06:49,005 botocore.hooks [DEBUG] Event needs-retry.s3.ListObjects: calling handler <botocore.retryhandler.RetryHandler object at 0x7fecc8ec2b30>
2023-04-14 03:06:49,005 botocore.retryhandler [DEBUG] No retry needed.
2023-04-14 03:06:49,005 botocore.hooks [DEBUG] Event needs-retry.s3.ListObjects: calling handler <bound method S3RegionRedirector.redirect_from_error of <botocore.utils.S3RegionRedirector object at 0x7fecc8ec2bf0>>
2023-04-14 03:06:49,005 botocore.utils [DEBUG] S3 request was previously redirected, not redirecting.
2023-04-14 03:06:49,006 botocore.hooks [DEBUG] Event after-call.s3.ListObjects: calling handler <function decode_list_object at 0x7fecca259a20>
{'ResponseMetadata': {'RequestId': '0P2GPVZGAEEYZ02V', 'HostId': 'aNWOdaUvWbiLVnqtV/Wu0L7I7hmWisf63zEMwaumxG83JcP5XVb1K63fCqhnx+AWmSbqmHQy7/c=', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amz-id-2': 'aNWOdaUvWbiLVnqtV/Wu0L7I7hmWisf63zEMwaumxG83JcP5XVb1K63fCqhnx+AWmSbqmHQy7/c=', 'x-amz-request-id': '0P2GPVZGAEEYZ02V', 'date': 'Fri, 14 Apr 2023 07:06:49 GMT', 'x-amz-bucket-region': 'us-west-1', 'content-type': 'application/xml', 'transfer-encoding': 'chunked', 'server': 'AmazonS3'}, 'RetryAttempts': 1}, 'IsTruncated': False, 'Marker': '', 'Contents': [{'Key': '50kb-doc (3) (1).paper', 'LastModified': datetime.datetime(2023, 4, 14, 7, 4, 2, tzinfo=tzutc()), 'ETag': '"f2974b114cba136bda15adb90f189e29"', 'Size': 60275, 'StorageClass': 'STANDARD', 'Owner': {'DisplayName': 'crest.it', 'ID': '1ec213dd8ce39db5ea8da3d6552449effacee6337758d64dff989f85018307b1'}}], 'Name': 'es-ent-05', 'Prefix': '', 'MaxKeys': 1000, 'EncodingType': 'url'}

@akanshi-elastic
Copy link
Author

Any update on this ?

@thehesiod
Copy link
Collaborator

the two traces don't match. The code run in botocore needs to be the same code as in aiobotocore. Could you return the logs from aiobotocore with the same code from botocore? thanks. Also is there any way I can reproduce this locally? perhaps with moto or if you create some test bucket with temp user for me? I put some social links on my profile if you'd like to contact me, thanks!

@akanshi-elastic
Copy link
Author

@thehesiod I tried to connect you via reddit. Please let me know when can we schedule a call?

@thehesiod
Copy link
Collaborator

@akanshi-elastic sorry about that! just replied with my email

@thehesiod
Copy link
Collaborator

you can send me a calendar with my username at gmail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants