boto3: fix: MissingContentLength in boto3 version 1.36.1
Describe the bug
Description
I encountered an issue while using boto3 version 1.36.1 in conjunction with django-storages. When attempting to upload files to AWS S3, I received the following error:
An error occurred (MissingContentLength) when calling the PutObject operation: Unknown
Steps to Reproduce
- Install
boto3version1.36.1anddjango-storages. - Configure Django to use S3 for file storage.
- Attempt to upload a file to S3.
Environment
boto3version:1.36.1django-storagesversion: django-storages==1.14.4- Django version: django==5.1.2
- Python version: python==3.11
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
The file should upload successfully without any errors.
Current Behavior
The upload fails with the MissingContentLength error.
Reproduction Steps
I found that downgrading boto3 to version 1.34.131 resolves the issue, and file uploads work as expected.
Possible Solution
No response
Additional Information/Context
No response
SDK version used
boto3 version: 1.36.1
Environment details (OS name and version, etc.)
ubuntu22.04 boto3 version: 1.36.1 - django-storages version: django-storages==1.14.4 - Django version: django==5.1.2 - Python version: python==3.11
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 17
- Comments: 22 (3 by maintainers)
Commits related to this issue
- Pin boto3 Should bypass this issue on uploads https://github.com/boto/boto3/issues/4398 ``` An error occurred (MissingContentLength) when calling the PutObject operation: Unknown ``` — committed to singiamtel/alibuild by singiamtel 2 years ago
- fix: pin boto3 Pin boto3 version to 1.35.99. version 1.36.0 of boto3 is affected by https://github.com/boto/boto3/issues/4398. — committed to cloudnative-pg/postgres-containers by fcanovai 2 years ago
- fix: pin boto3 Pin boto3 version to 1.35.99. version 1.36.0 of boto3 is affected by https://github.com/boto/boto3/issues/4398. Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com> — committed to cloudnative-pg/postgres-containers by fcanovai 2 years ago
- fix: pin boto3 Pin boto3 version to 1.35.99. version 1.36.0 of boto3 is affected by https://github.com/boto/boto3/issues/4398. Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com> — committed to cloudnative-pg/postgres-containers by fcanovai 2 years ago
- Pin boto3 (#900) Should bypass this issue on uploads https://github.com/boto/boto3/issues/4398 ``` An error occurred (MissingContentLength) when calling the PutObject operation: Unknown ``` — committed to alisw/alibuild by singiamtel 2 years ago
- fix: pin boto3 Pin boto3 version to 1.35.99. version 1.36.0 of boto3 is affected by https://github.com/boto/boto3/issues/4398. Closes #139 Signed-off-by: Francesco Canovai <francesco.canovai@enterp... — committed to cloudnative-pg/postgres-containers by fcanovai 2 years ago
- fix: pin boto3 (#140) Pin boto3 version to 1.35.99. version 1.36.0 of boto3 is affected by https://github.com/boto/boto3/issues/4398. Closes #139 Signed-off-by: Francesco Canovai <francesco.canovai... — committed to cloudnative-pg/postgres-containers by fcanovai 2 years ago
- fix: pin boto3 (#140) Pin boto3 version to 1.35.99. version 1.36.0 of boto3 is affected by https://github.com/boto/boto3/issues/4398. Closes #139 Signed-off-by: Francesco Canovai <francesco.canovai... — committed to cloudnative-pg/postgres-containers by fcanovai 2 years ago
- Pin boto3 Should bypass this issue on uploads https://github.com/boto/boto3/issues/4398 ``` An error occurred (MissingContentLength) when calling the PutObject operation: Unknown ``` — committed to singiamtel/ali-bot by singiamtel 2 years ago
- Update git submodules * Update charm-ceph-radosgw from branch 'master' to 41d4c74ec9697d93c4b683a401517c4aba29bebd - Tests: pin boto3 For https://github.com/boto/boto3/issues/4398 ... — committed to openstack/openstack by sabaini 2 years ago
- Tests: pin boto3 For https://github.com/boto/boto3/issues/4398 Also lint updates Signed-off-by: Peter Sabaini <peter.sabaini@canonical.com> Change-Id: Ieb248434b482f513060ca8b453e2068d51fde9cf — committed to openstack/charm-ceph-radosgw by sabaini 2 years ago
- Tests: pin boto3 For https://github.com/boto/boto3/issues/4398 Also lint updates Signed-off-by: Peter Sabaini <peter.sabaini@canonical.com> Change-Id: Ieb248434b482f513060ca8b453e2068d51fde9cf Cher... — committed to openstack/charm-ceph-radosgw by sabaini 2 years ago
- fix: pin boto3 Pin boto3 version to 1.35.99, version 1.36.0 of boto3 is affected by https://github.com/boto/boto3/issues/4398. Signed-off-by: Jonathan Gonzalez V. <jonathan.gonzalez@enterprisedb.com... — committed to cloudnative-pg/postgis-containers by sxd 2 years ago
- fix: pin boto3 (#66) Pin boto3 version to 1.35.99, version 1.36.0 of boto3 is affected by https://github.com/boto/boto3/issues/4398. Signed-off-by: Jonathan Gonzalez V. <jonathan.gonzalez@enterpr... — committed to cloudnative-pg/postgis-containers by sxd 2 years ago
- Pin working version of boto3. There is apparently a bug with the latest boto3 : https://github.com/boto/boto3/issues/4398 — committed to braingeneers/braingeneerspy by DailyDreaming 2 years ago
- Pin boto3 to 1.34.131 This avoids a missing content length error: https://github.com/boto/boto3/issues/4398?t — committed to atmsillinois/DownscaledClimateData by BenGalewsky 2 years ago
- Pin working version of boto3. (#109) There is apparently a bug with the latest boto3 : https://github.com/boto/boto3/issues/4398 — committed to braingeneers/braingeneerspy by DailyDreaming 2 years ago
- fix: televersement des fichiers en erreur (#899) ## Description 🛑 téléversement de fichier impossible. Erreur 500. 🎸 Issue #897 : `botocore.exceptions.ClientError: An error occurred (Missing... — committed to gip-inclusion/itou-communaute-django by vincentporte 2 years ago
- Tests: pin boto3 For https://github.com/boto/boto3/issues/4398 Also lint updates Signed-off-by: Peter Sabaini <peter.sabaini@canonical.com> Change-Id: Ieb248434b482f513060ca8b453e2068d51fde9cf Cher... — committed to sabaini/ceph-charms by sabaini 2 years ago
- Downgrade boto3 There's a change in newer versions for some aws behavior that doesn't apply to radosgw, so I'm just downgrading since that's easier to experiment with https://github.com/boto/boto3/i... — committed to ComputerScienceHouse/gallery by mxmeinhold 2 years ago
Downgrading to boto3==1.35.95 seem to be fixing the problem, at least as a temporary solution
I can confirm that we are also facing same issue.
After upgrading
boto3to1.36.1(or to1.36.2) we started getting error:When downgraded
boto3to1.35.99error disappears.We are using DigitalOcean Spaces S3 compatible buckets.
If it helps anyone, to fix this in Github Action environment you need to add two envs vars:
For me it fixed the issue trying to upload to s3 “compatible” storage
This solved the issue for OCI buckets, thank you
As mentioned, for those using third-party storage services, you can disable the new checksum behavior by setting
request_checksum_calculationandresponse_checksum_validationtowhen_required. Please note that a bug related to these configuration options not applying to high-level S3 operations was fixed ins3transfer-0.11.2. You should update to at leastboto3-1.36.5for this option to work as intended. If you continue to have problems, please feel free to open a new issue.This is also an issue with pyiceberg/s3fs
Thank you @zaosoula - it works when using the amazon.aws Ansible module as well.
Used the following settings:
Downgraded to boto3==1.35.95 , now contabo and idrive both work
Hi @alireza-fa, thanks for reaching out. This is related to the recent announcement of new default checksum behavior starting in
v1.36.0. I suspect this is likely an issue withdjango-storages.Are you able to reproduce this behavior using AWS S3, or with default integrity options set to
when-required?