Getting RequestTimeout from S3 when loading to the designated URL

For small files, say <5Mb, uploading to S3 using the assigned URL works fine. When I try to download anything more than this, I seem to get answers 400 Bad Requestfrom S3 with RequestTimeoutas an error.

I can recreate this with curl:

# Create a test file:
mkfile -n 20m ./testfile

# Get the presigned URL
curl -XPOST http://localhost:3000/uploads -d "filename=testdata"

# Upload to S3
curl -H "Content-Type: binary/octet-stream" -XPUT -vvv -T testfile "<Presigned URL>"

The signature code is as follows:

@presigned_url ||= Aws::S3::Presigner.new.presigned_url(
  :put_object,
  bucket: ENV['AWS_BUCKET'],
  key: key,
  acl: 'private',
  expires_in: 3600,
  content_type: 'binary/octet-stream'
)

Please note that all this works fine for files <5Mb, with more frequent crashes that occur when the file size increases. Has anyone seen these problems and resolved them?

+4
source share

Source: https://habr.com/ru/post/1688446/


All Articles