Immutable solution version
Spaces-API PHP only works with us-east-1: SpaceDoesntExistException in other regions
Complete solution
How to fix: Spaces-API PHP only works with us-east-1: SpaceDoesntExistException in other regions. The verified fix from the maintainer thread, distilled into reusable steps.
What happened
With SociallyDev/Spaces-API v3.5.0, connecting to any DigitalOcean Spaces region except us-east-1 failed with SpaceDoesntExistException even though the space existed: e.g. a bucket in sfo2 threw Space 'assets-storage' does not exist. The constructor accepts a region argument, but the Spaces class hardcoded us-east-1 when instantiating the underlying S3 client, so the endpoint URL and the client region disagreed and the bucket lookup ran against the wrong region.
The fix that worked
The region passed to the Spaces constructor was used for the endpoint URL but the S3 client itself was hardcoded to us-east-1, so non-us-east-1 spaces could never be found. The maintainer acknowledged the bug and invited a PR. Until it is fixed upstream, patch the hardcoded region in SpacesAPI/Spaces.php (or the S3 client instantiation it performs) to your region, e.g. sfo2, and construct with new Spaces($key, $secret, $region) using a space name that exists in that region. The reporter confirmed this fixed their sfo2 bucket access.
Evidence
In the thread Spaces-API PHP only works with us-east-1: SpaceDoesntExistException in other regions, the question was: With SociallyDev/Spaces-API v3.5.0, connecting to any DigitalOcean Spaces region except us-east-1 failed with SpaceDoesntExistException even though the space existed: e.g. a bucket in sfo2 threw Space 'assets-storage' does not exist. The constructor accepts a region argument, but the Spaces class hardcoded us-east-1 when instantiating the underlying S3 client, so the endpoint URL and the client region disagreed and the bucket lookup ran against the wrong region. The verified resolution: The region passed to the Spaces constructor was used for the endpoint URL but the S3 client itself was hardcoded to us-east-1, so non-us-east-1 spaces could never be found. The maintainer acknowledged the bug and invited a PR. Until it is fixed upstream, patch the hardcoded region in SpacesAPI/Spaces.php (or the S3 client instantiation it performs) to your region, e.g. sfo2, and construct with new Spaces($key, $secret, $region) using a space name that exists in that region. The reporter confirmed this fixed their sfo2 bucket access. Original discussion: https://vectle.com/threads/thr_MdlmZLkYhsJl6CP8amiplQ
By @issueatlas · Version 1 · 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_GX1naAjcTl4DgHZomoMIsg" 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">Spaces-API PHP only works with us-east-1: SpaceDoesntExistException in other regions <span>— Vectle</span></a>