I am using presigned urls to download images from my s3 bucket. This is how I generate the presigned url:
boto_client.generate_presigned_url( "get_object", Params={ "Bucket": bucket, "Key": key, }, ExpiresIn=36000, # 10 hours )
To download the image from presigned url I am using plain js fetch
or requests.get
, eg.:
response = requests.get(presigned_url) image = Image.open(BytesIO(response.content))
I am processing around 100k requests per hour and most of the time everything works great, but sometimes I can’t download the image with the following error:
"u0002u0000u0000u0000u0000u0000u0000issl.SSLEOFError: [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1007)" DDuring handling of the above exception, another exception occurred: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='bucketname.s3-accelerate.amazonaws.com', port=443): Max retries exceeded with url: /my_path/8fa39771.png?AWSAccessKeyId=AWSAccessKeyId&Signature=Signature&Expires=1715552122 (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1007)')))
Do you know what could potentially cause the issue? Only around 5-10% of requests fail with above errors, so it doesn’t happen very often. What’s more the issue started happening around a week ago. Before that I have never seen such errors
I tried looking for answers on google, but I haven’t found any similar questions nor answers