fix(nodes): handle empty HTTP 204 response for S3 "Delete Bucket" operation#28734
Open
harshitnub077 wants to merge 10 commits inton8n-io:masterfrom
Open
fix(nodes): handle empty HTTP 204 response for S3 "Delete Bucket" operation#28734harshitnub077 wants to merge 10 commits inton8n-io:masterfrom
harshitnub077 wants to merge 10 commits inton8n-io:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
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.
Contributor
There was a problem hiding this comment.
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
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
bucket:deleteoperation 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(), callingresponse.includes(...)on an empty/undefined response threw aTypeErrorthat 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
awsApiRequestRESTto 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:
Bucket, Operation =Delete, and provide a valid (empty) bucket nameRelated Linear tickets, Github issues, and Community forum posts
Fixes #27396
Review / Merge checklist
AwsS3.node.operation.test.ts)Backport to Beta,Backport to Stable, orBackport to v1(if the PR is an urgent fix that needs to be backported)