I tried to run the example script here:
And I got this error:
operation error S3: ListBuckets, https response error StatusCode: 501, RequestID: , HostID: , api error NotImplemented: ListBuckets search parameter x-id not implemented
This looks to me like AWS updated their Go SDK to query for a new parameter
x-id (no idea what that is) and R2 hasn’t implemented it yet.
However the fact that this script was on the official R2 docs suggests to me that it must have worked at some point in time.
So I downgraded my AWS SDK version to this:
And lo and behold, it works now.
So my suggestion is to state on the Docs which versions of the SDK R2 is supposed to work with, otherwise AWS is going to keep changing their SDK so that it doesn’t work with R2.
Another way is for Cloudflare to fork the SDK so as to prevent AWS from making changes to it that make it stop working with R2.