Skip to content

fix(nodes): handle empty HTTP 204 response for S3 "Delete Bucket" operation#28734

Open
harshitnub077 wants to merge 10 commits inton8n-io:masterfrom
harshitnub077:fix/s3-delete-bucket-operation
Open

fix(nodes): handle empty HTTP 204 response for S3 "Delete Bucket" operation#28734
harshitnub077 wants to merge 10 commits inton8n-io:masterfrom
harshitnub077:fix/s3-delete-bucket-operation

Conversation

@harshitnub077
Copy link
Copy Markdown

@harshitnub077 harshitnub077 commented Apr 20, 2026

Summary

Fixes the bucket:delete operation in the AWS S3 node, which appeared to silently do nothing when executed.

Root cause: The AWS S3 API returns HTTP 204 No Content (empty body) on a successful bucket deletion. In GenericFunctions.ts > awsApiRequestREST(), calling response.includes(...) on an empty/undefined response threw a TypeError that was silently caught - causing the operation to succeed at the network level but produce no output or visible error to the user.

Fix: Added a guard in awsApiRequestREST to return early for empty/non-string responses before attempting XML or JSON parsing. This correctly handles HTTP 204 responses, which is standard REST API behavior for successful DELETE operations.

How to test:

  1. Set up AWS credentials in n8n
    1. Create a workflow with the AWS S3 node
    1. Set Resource = Bucket, Operation = Delete, and provide a valid (empty) bucket name
    1. Run the workflow - it should now return { success: true } instead of doing nothing

Related Linear tickets, Github issues, and Community forum posts

Fixes #27396

Review / Merge checklist

  • I have seen this code, I have run this code, and I take responsibility for this code.
  • - [ ] PR title and summary are descriptive. (conventions)
  • - [ ] Docs updated or follow-up ticket created.
  • - [x] Tests included. (2 unit tests added to AwsS3.node.operation.test.ts)
  • - [ ] PR Labeled with Backport to Beta, Backport to Stable, or Backport to v1 (if the PR is an urgent fix that needs to be backported)
  • [ ]

Copilot AI review requested due to automatic review settings April 20, 2026 17:39
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 20, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes AWS S3 V2 “Bucket: Delete” handling when the S3 API returns an empty body (HTTP 204), avoiding response parsing attempts that can throw on empty/non-string responses.

Changes:

  • Add an early-return guard in awsApiRequestREST() for empty/non-string responses before XML/JSON parsing.
  • Add unit tests for the AWS S3 V2 node bucket delete operation with empty responses.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/nodes-base/nodes/Aws/S3/V2/GenericFunctions.ts Adds a guard to skip parsing for empty/non-string REST responses (e.g. 204 No Content).
packages/nodes-base/nodes/Aws/S3/test/V2/AwsS3.node.operation.test.ts Adds tests for Bucket Delete returning { success: true } when API response is empty.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/nodes-base/nodes/Aws/S3/V2/GenericFunctions.ts Outdated
Comment thread packages/nodes-base/nodes/Aws/S3/test/V2/AwsS3.node.operation.test.ts Outdated
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Architecture diagram
sequenceDiagram
    participant Engine as Workflow Engine
    participant Node as AWS S3 Node
    participant Lib as GenericFunctions (awsApiRequestREST)
    participant AWS as AWS S3 API

    Engine->>Node: execute()
    Node->>Lib: awsApiRequestREST(method: 'DELETE')
    Lib->>AWS: HTTP DELETE /bucket-name
    AWS-->>Lib: 204 No Content (Empty Body)

    Note over Lib: CHANGED: Response validation logic
    
    alt Response is empty or non-string
        Lib->>Lib: NEW: Return response early
    else Response contains data
        Lib->>Lib: Check for XML/JSON signatures
        Lib->>Lib: Parse response body
    end

    Lib-->>Node: Empty response (undefined/string)
    
    Note over Node: Process return value
    Node-->>Engine: NEW: Return { success: true }
    
    alt NEW: Error Path (Unchanged but validated)
        AWS-->>Lib: 4xx/5xx Error
        Lib-->>Node: Throw Error
        Node-->>Engine: Operation Failed
    end
Loading

@n8n-assistant n8n-assistant Bot added community Authored by a community member node/improvement New feature or request labels Apr 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Authored by a community member node/improvement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: S3 node - 'Delete Bucket' operation does nothing (not implemented)

3 participants