S3 DeleteBucket reports ResourceNotEmpty instead of BucketNotEmpty
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
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from supabase/storage
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 62/100
supabase/storage#557 · 1 comment ·
Maintainers usually reply within 1 day
-
Resumable (tus) upload creation with Upload-Length: 0 returns 404 with no explanationMay be free again @ferhatelmas claimed this 55 days ago, and no pull request is open. Open
supabase/storage#1300 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Local Storage TUS rejects signed upload token generated by the same stack with "Invalid Compact JWS"May be free again @TylerHillery claimed this 62 days ago, and no pull request is open. Openbug
supabase/storage#1268 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Supabase Storage: multipart uploads and `x-upsert` rejected with a misleading RLS errorMay be free again @ferhatelmas claimed this 62 days ago, and no pull request is open. Openbug
supabase/storage#1241 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in supabase/storage
Similar issues
-
priority: P2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
prime-radiant-inc/evener#3291 ·
Maintainers usually reply within 1 day
-
accessibility bug revealjs
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
quarto-dev/quarto-cli#14961 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
supabase/agent-skills#614 ·
-
Content
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
RunestoneInteractive/rs#1559 · 1 comment ·
Maintainers usually reply within 2 days