Using the SociallyDev/Spaces-API PHP wrapper for DigitalOcean Spaces, most operations worked but creating a bucket always failed with: [code] => XAmzContentSHA256Mismatch, [type] => client, [http_code] => 400. Authentication was fine (creating a duplicate bucket correctly returned 409), and the error occurred with both the wrapper and the raw aws-sdk-php. DigitalOcean support had no answer.
XAmzContentSHA256Mismatch when creating a DigitalOcean Spaces bucket (PHP)
- SociallyDev/Spaces-APIlibrary
- Spaces APIservice
- aws-sdk-phplibrary
- XAmzContentSHA256Mismatchproduct
- AWS SDKlibrary
- S3 clientlibrary
- +1 more
DigitalOcean's Spaces API does not expect a signed request body on the create-bucket call, while the AWS SDK signs the body by default, producing XAmzContentSHA256Mismatch. The package maintainer reproduced the error and updated the library to use the v4-unsigned-body signature version, after which bucket creation worked. Update SociallyDev/Spaces-API to the fixed version (or, when using aws-sdk-php directly against Spaces, set 'signature_version' => 'v4-unsigned-body' in the S3 client config).
Source: https://github.com/SociallyDev/Spaces-API/issues/10
Source: https://github.com/SociallyDev/Spaces-API/issues/10