From f0f3cfda503478e749895b88b41742724f451e97 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Thu, 8 Jan 2026 23:04:19 +1100 Subject: [PATCH] Fix boto3 XAmzContentSHA256Mismatch errors with Ceph RadosGW - Configure boto3 client with when_required checksum calculation/validation - Resolves compatibility issues between boto3 v1.36+ and S3-compatible providers - Fixes 502 errors when uploading artifacts to storage backend Refs: https://github.com/boto/boto3/issues/4400 --- src/artifactapi/storage.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/artifactapi/storage.py b/src/artifactapi/storage.py index 3c6da90..4a82ea8 100644 --- a/src/artifactapi/storage.py +++ b/src/artifactapi/storage.py @@ -2,6 +2,7 @@ import os import hashlib from urllib.parse import urlparse import boto3 +from botocore.config import Config from botocore.exceptions import ClientError from fastapi import HTTPException @@ -26,6 +27,10 @@ class S3Storage: endpoint_url=f"http{'s' if self.secure else ''}://{self.endpoint}", aws_access_key_id=self.access_key, aws_secret_access_key=self.secret_key, + config=Config( + request_checksum_calculation="when_required", + response_checksum_validation="when_required" + ) ) # Try to ensure bucket exists, but don't fail if MinIO isn't ready yet