Backblaze S3 Compatibility Issue: Image Upload Error in Dify Docker 0.15.3 #8047

Closed
opened 2026-02-21 18:23:38 -05:00 by yindo · 2 comments
Owner

Originally created by @imleaver on GitHub (Feb 7, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.15.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Summary
When running Dify Docker (self - hosted) version 0.15.3 integrated with Backblaze S3 - compatible storage, an error occurs when attempting to upload or load previously uploaded images.
Environment Details
Dify Version: 0.15.3 (self - hosted Docker)
Storage Provider: Backblaze S3 - compatible

Steps to Reproduce
Upload media in chatbox

Expected Behavior
The image should be uploaded successfully and loaded without any errors when accessed later.

Actual Behavior
An error occurs during the image upload process. The following error is logged:

2025-02-07 09:17:51.986 ERROR [Dummy-13] [app.py:875] - Exception on /console/api/files/upload [POST]
Traceback (most recent call last):
File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 489, in wrapper
resp = resource(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view
return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
resp = meth(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/wraps.py", line 142, in decorated
return view(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/libs/login.py", line 93, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/wraps.py", line 26, in decorated
return view(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 696, in wrapper
resp = f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/wraps.py", line 85, in decorated
return view(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/files.py", line 72, in post
upload_file = FileService.upload_file(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/services/file_service.py", line 67, in upload_file
storage.save(file_key, content)
File "/app/api/extensions/ext_storage.py", line 80, in save
raise e
File "/app/api/extensions/ext_storage.py", line 77, in save
self.storage_runner.save(filename, data)
File "/app/api/extensions/storage/aws_s3_storage.py", line 52, in save
self.client.put_object(Bucket=self.bucket_name, Key=filename, Body=data)
File "/app/api/.venv/lib/python3.12/site-packages/botocore/client.py", line 569, in _api_call
return self._make_api_call(operation_name, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/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: Unsupported header 'x-amz-sdk-checksum-algorithm' received for this API call.

Possible Cause
It seems that the x-amz-sdk-checksum-algorithm header sent during the PutObject operation is not supported by Backblaze S3 - compatible storage.

Additional Information
I suggest to have some s3-compatible storage type where it doesn't submit x-amz-sdk-checksum-algorithm in header.

✔️ Expected Behavior

It should be able to upload or load the image media successfully.

It was working with 0.15.2 version.

Actual Behavior

docker api logging show Unsupported header 'x-amz-sdk-checksum-algorithm'

Image

Image unable to load during list the app.
Image

Upload fail too

Image

Originally created by @imleaver on GitHub (Feb 7, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.15.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce **Summary** When running Dify Docker (self - hosted) version 0.15.3 integrated with Backblaze S3 - compatible storage, an error occurs when attempting to upload or load previously uploaded images. Environment Details Dify Version: 0.15.3 (self - hosted Docker) Storage Provider: Backblaze S3 - compatible **Steps to Reproduce** Upload media in chatbox **Expected Behavior** The image should be uploaded successfully and loaded without any errors when accessed later. **Actual Behavior** An error occurs during the image upload process. The following error is logged: > 2025-02-07 09:17:51.986 ERROR [Dummy-13] [app.py:875] - Exception on /console/api/files/upload [POST] Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 489, in wrapper resp = resource(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 604, in dispatch_request resp = meth(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 142, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/libs/login.py", line 93, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 26, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 696, in wrapper resp = f(*args, **kwargs) ^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 85, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/files.py", line 72, in post upload_file = FileService.upload_file( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/services/file_service.py", line 67, in upload_file storage.save(file_key, content) File "/app/api/extensions/ext_storage.py", line 80, in save raise e File "/app/api/extensions/ext_storage.py", line 77, in save self.storage_runner.save(filename, data) File "/app/api/extensions/storage/aws_s3_storage.py", line 52, in save self.client.put_object(Bucket=self.bucket_name, Key=filename, Body=data) File "/app/api/.venv/lib/python3.12/site-packages/botocore/client.py", line 569, in _api_call return self._make_api_call(operation_name, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/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: Unsupported header 'x-amz-sdk-checksum-algorithm' received for this API call. **Possible Cause** It seems that the **`x-amz-sdk-checksum-algorithm`** header sent during the PutObject operation is not supported by Backblaze S3 - compatible storage. **Additional Information** I suggest to have some s3-compatible storage type where it doesn't submit **x-amz-sdk-checksum-algorithm** in header. ### ✔️ Expected Behavior It should be able to upload or load the image media successfully. It was working with 0.15.2 version. ### ❌ Actual Behavior docker api logging show Unsupported header 'x-amz-sdk-checksum-algorithm' <img width="1359" alt="Image" src="https://github.com/user-attachments/assets/0bf420f6-5e8f-47d9-a8db-aaef619c8b3d" /> Image unable to load during list the app. ![Image](https://github.com/user-attachments/assets/93b3c64e-b739-424e-b97d-b212f1fdd0aa) Upload fail too ![Image](https://github.com/user-attachments/assets/b31ab8b1-7d52-4109-99ee-fee42911e85c)
yindo added the 🐞 buggood first issue labels 2026-02-21 18:23:38 -05:00
yindo closed this issue 2026-02-21 18:23:39 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 7, 2025):

Hey there, @imleaver! I'm here to help you with your bug report. I can assist with solving bugs, answering questions, and even becoming a contributor. Let's tackle this issue together while we wait for a human maintainer.

The issue you're encountering with Backblaze S3-compatible storage in Dify version 0.15.3 is due to the x-amz-sdk-checksum-algorithm header being included in the PutObject operation, which Backblaze does not support. This header was not present in version 0.15.2, which is why it worked previously.

To resolve this, you can modify the AwsS3Storage class in the api/extensions/storage/aws_s3_storage.py file to exclude this header when using Backblaze or other S3-compatible storage providers that do not support it. Currently, the headers for the PutObject operation are not explicitly set in the code, so you may need to adjust the boto3 client configuration or the put_object call to conditionally exclude this header based on the storage provider.

Additionally, you might want to check if there are any configuration options or conditional checks in the codebase that allow for customizing headers for different storage providers. If not, implementing such a feature could be a potential solution to avoid compatibility issues with S3-compatible storage providers like Backblaze.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Feb 7, 2025): <!-- Greeting --> Hey there, @imleaver! I'm here to help you with your bug report. I can assist with solving bugs, answering questions, and even becoming a contributor. Let's tackle this issue together while we wait for a human maintainer. <!-- Answer --> The issue you're encountering with Backblaze S3-compatible storage in Dify version 0.15.3 is due to the `x-amz-sdk-checksum-algorithm` header being included in the `PutObject` operation, which Backblaze does not support. This header was not present in version 0.15.2, which is why it worked previously. To resolve this, you can modify the `AwsS3Storage` class in the `api/extensions/storage/aws_s3_storage.py` file to exclude this header when using Backblaze or other S3-compatible storage providers that do not support it. Currently, the headers for the `PutObject` operation are not explicitly set in the code, so you may need to adjust the boto3 client configuration or the `put_object` call to conditionally exclude this header based on the storage provider. Additionally, you might want to check if there are any configuration options or conditional checks in the codebase that allow for customizing headers for different storage providers. If not, implementing such a feature could be a potential solution to avoid compatibility issues with S3-compatible storage providers like Backblaze. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/72bb6c18-4205-45fd-bd83-0fc5ee1ffe52?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/72bb6c18-4205-45fd-bd83-0fc5ee1ffe52?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/72bb6c18-4205-45fd-bd83-0fc5ee1ffe52?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/72bb6c18-4205-45fd-bd83-0fc5ee1ffe52?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/72bb6c18-4205-45fd-bd83-0fc5ee1ffe52?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/72bb6c18-4205-45fd-bd83-0fc5ee1ffe52?feedback_type=other)</sup>
Author
Owner

@xhdd123321 commented on GitHub (Feb 7, 2025):

It seems your issue is similar to what I encountered. I am submitting a pr to fix it. https://github.com/langgenius/dify/pull/13354

@xhdd123321 commented on GitHub (Feb 7, 2025): It seems your issue is similar to what I encountered. I am submitting a pr to fix it. https://github.com/langgenius/dify/pull/13354
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8047