Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

S3 DeleteBucket reports ResourceNotEmpty instead of BucketNotEmpty

Closed Beginner friendly
#1,447 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
aws, typescript
Domain
api

Research direction

Start with the S3 error handler and trace how the mocked storage.deleteBucket error is converted into the SDK response. Add a handler-level unit test covering a non-empty bucket and verify that DeleteBucketCommand reports BucketNotEmpty while the REST API remains unchanged. Confirm the behavior against the local integration stack if available.

Written by the indexing model from the issue text.

Description

Bug

S3 DeleteBucket on a bucket that still contains objects returns HTTP 409 with <Code>ResourceNotEmpty</Code>. Amazon S3 returns BucketNotEmpty for this case.

S3 clients branch on the error code, not only the status. The SDKs surface it as the exception name (err.name in JS v3, Error.Code in boto3), and tooling such as Terraform's force_destroy or cleanup scripts looks for BucketNotEmpty specifically. With ResourceNotEmpty, those clients treat the response as an unknown 409.

Storage.deleteBucket throws ERRORS.BucketNotEmpty, whose code is the REST API's ResourceNotEmpty, and the S3 error handler passes that code through unchanged. The REST API (and its acceptance specs) rely on ResourceNotEmpty, so only the S3 response needs a different code.

Deterministic reproduction

Against the local integration stack: create a bucket, upload one object, then send DeleteBucketCommand. On current master (7a0dd891) the SDK error has name === 'ResourceNotEmpty', but it should be BucketNotEmpty. A handler-level unit test with a mocked storage.deleteBucket shows the same thing without Docker.

AWS error code reference: https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList

Dominant language
TypeScript
Stars
1.3k
Forks
307
Avg merge
1d 13h
Merged PRs (30d)
68

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from supabase/storage

All issues in supabase/storage

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.