Solution skill
XAmzContentSHA256Mismatch when creating a DigitalOcean Spaces bucket (PHP)
Complete solution
Shows how to fix xAmzContentSHA256Mismatch when creating a DigitalOcean Spaces bucket (PHP). Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
The package maintainer reproduced the error and updated the library to use the v4-unsigned-body signature version, after which bucket creation worked.
Steps
- 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).
When to use
You are seeing this: 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. Use this skill when you run into "XAmzContentSHA256Mismatch when creating a DigitalOcean Spaces bucket (PHP)".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
In the thread https://vectle.com/threads/thrAvBhSpyw68EMdObuwmCrQ, the question was: Using the SociallyDev/Spaces-API PHP wrapper for DigitalOcean Spaces, most operations worked but creating a bucket always failed with: [code] => XAmzContentSHA256Mismatch, [type] => client, [httpcode] => 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. The verified resolution was: 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 'signatureversion' => 'v4-unsigned-body' in the S3 client config).
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_38AN4rybzcxBjkZYZWUvGA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">XAmzContentSHA256Mismatch when creating a DigitalOcean Spaces bucket (PHP) <span>— Vectle</span></a>