Skip to content

Backblaze B2 instructions broken for boto3 >= 1.35.99 (Unsupported header 'x-amz-sdk-checksum-algorithm' received) #1498

@z1ga

Description

@z1ga

As per Backblaze B2 documentation S3 boto client released after version 1.35.99 has data integrity protection headers enabled by default. These headers aren't supported by Backblaze servers, which results in the following exception when trying to use django-storages with Backblaze B2:

ClientError: An error occurred (InvalidArgument) when calling the PutObject operation: Unsupported header 'x-amz-sdk-checksum-algorithm' received for this API call.

Backblaze documentation suggests downgrading the boto3 client, however one can simply set the client_config's request_checksum_calculation and response_checksum_validation to when_required.

Example of working config:

# settings.py


import os
from botocore.config import Config

STORAGES = {
    "default": {
        "BACKEND": "storages.backends.s3.S3Storage",
        "OPTIONS": {
            "bucket_name": os.environ["S3_BUCKET_NAME"],
            "access_key": os.environ["S3_ACCESS_KEY_ID"],
            "secret_key": os.environ["S3_SECRET_ACCESS_KEY"],
            "endpoint_url": "https://s3.eu-central-003.backblazeb2.com",
            "client_config": Config(
                request_checksum_calculation="when_required", 
                response_checksum_validation="when_required",
            ),
        },
    },
}

I suggest updating the django-storages Backblaze B2 docs with this information to help others avoid this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions