You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am encountering a ClientError: InvalidArgument when attempting to upload files to an S3 bucket using django-storages==1.14.4. This issue did not occur with django-storages==1.10, where the file upload process worked seamlessly. The error message is as follows:
Internal Server Error: /chats/generate-document/
Traceback (most recent call last):
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\django\views\generic\base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\django\utils\decorators.py", line 48, in _wrapper
return bound_method(*args, **kwargs)
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\django\views\decorators\csrf.py", line 65, in _view_wrapper
return view_func(request, *args, **kwargs)
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\django\views\generic\base.py", line 143, in dispatch
return handler(request, *args, **kwargs)
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\chat_app\views.py", line 235, in post
user_chat.document.save(file_name, ContentFile(buffer.getvalue()))
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\django\db\models\fields\files.py", line 99, in save
self.name = self.storage.save(name, content, max_length=self.field.max_length)
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\django\core\files\storage\base.py", line 49, in save
name = self._save(name, content)
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\storages\backends\s3.py", line 564, in _save
obj.upload_fileobj(content, ExtraArgs=params, Config=self.transfer_config)
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\boto3\s3\inject.py", line 731, in object_upload_fileobj
return self.meta.client.upload_fileobj(
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\boto3\s3\inject.py", line 642, in upload_fileobj
return future.result()
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\s3transfer\futures.py", line 103, in result
return self._coordinator.result()
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\s3transfer\futures.py", line 266, in result
raise self._exception
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\s3transfer\tasks.py", line 139, in __call__
return self._execute_main(kwargs)
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\s3transfer\tasks.py", line 162, in _execute_main
return_value = self._main(**kwargs)
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\s3transfer\upload.py", line 764, in _main
client.put_object(Bucket=bucket, Key=key, Body=body, **extra_args)
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\botocore\client.py", line 569, in _api_call
return self._make_api_call(operation_name, kwargs)
File "C:\Users\tariq\OneDrive\Desktop\Important\aidocgen\venv\lib\site-packages\botocore\client.py", line 1023, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidArgument) when calling the PutObject operation: None
I have an S3 bucket with proper permissions, and the relevant bucket policies and IAM roles are configured to allow s3:PutObject, s3:GetObject, and s3:PutObjectAcl. The bucket has been set with public read/write access, and the storage configuration uses the django-storages package with boto3. Despite this, the error persists in the newer version of django-storages.
The same file upload code works without issues on django-storages==1.10, which leads me to believe the issue may be related to changes introduced in the newer version. I would appreciate any insights or advice on how to resolve this error and whether there are any known issues or differences between the two versions that could be causing this problem.
Issue occurring on
user_chat.document.save(file_name, ContentFile(buffer.getvalue()))
The text was updated successfully, but these errors were encountered:
I am encountering a ClientError: InvalidArgument when attempting to upload files to an S3 bucket using django-storages==1.14.4. This issue did not occur with django-storages==1.10, where the file upload process worked seamlessly. The error message is as follows:
I have an S3 bucket with proper permissions, and the relevant bucket policies and IAM roles are configured to allow s3:PutObject, s3:GetObject, and s3:PutObjectAcl. The bucket has been set with public read/write access, and the storage configuration uses the django-storages package with boto3. Despite this, the error persists in the newer version of django-storages.
The same file upload code works without issues on django-storages==1.10, which leads me to believe the issue may be related to changes introduced in the newer version. I would appreciate any insights or advice on how to resolve this error and whether there are any known issues or differences between the two versions that could be causing this problem.
Issue occurring on
user_chat.document.save(file_name, ContentFile(buffer.getvalue()))
The text was updated successfully, but these errors were encountered: