For Workes & Pages, what is the name of the domain?
n/a
What is the error message?
<?xml version= \"1.0\" encoding= \"UTF-8\"?>InvalidArgument
Invalid Argument: Unsupported search param(s) "X-Amz-Algorithm", "X-Amz-Content-Sha256", "X-Amz-Credential", "X-Amz-Date", "X-Amz-Expires", "X-Amz-Signature", "X-Amz-SignedHeaders" on a DELETE bucket route
What is the issue or error you’re encountering
See title.
What are the steps to reproduce the issue?
I am trying to delete an R2 bucket via a worker. I am using the AWS SDK for NodeJS v3 and carefully making sure that the calls I make don’t use unavailable NodeJS API functions. If there is a better way to do this I’d love to hear it. R2 bindings don’t suit me as my application uses dynamically created/deleted buckets on a per account basis.
Mostly that just works, but some calls in the AWS SDK need the NodeJS FileReader, which is not available. Particularly some delete calls. I’ve solved this so far by signing and then fetching the request, which avoids the unavailable Node API. More info here: Cloudflare Workers environment don't have FileReader defined · Issue #4765 · aws/aws-sdk-js-v3 · GitHub.
However, that doesn’t work for DeleteBucket commands. So, my question is, how can I delete a bucket inside a worker? My code to repro this issue is below. Thanks in advance.
const deleteBucket = async (env: Env, bucket: string) => {
const s3 = getS3Client(env);
const deleteParams: DeleteBucketCommandInput = { Bucket: bucket };
const cmd = new DeleteBucketCommand(deleteParams);
const signed = await getSignedUrl(s3, cmd);
await fetch(signed, { method: ‘DELETE’ });
};