fix: ReadableStream not handling error properly#38081
Conversation
|
Looks like this PR is ready to merge! 🎉 |
🦋 Changeset detectedLatest commit: 2f2a626 The changes in this PR will be included in the next version bump. This PR includes changesets to release 40 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughAdds explicit error handling to the request body ReadableStream used by getUploadFormData and test coverage to verify the function rejects when the request stream is aborted. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client
participant ServerHandler as getUploadFormData
participant ReadableBody as Readable.fromWeb(body)
participant Busboy
rect rgba(200,230,255,0.4)
Client->>ServerHandler: POST multipart/form-data (request.body)
ServerHandler->>ReadableBody: wrap request.body
ReadableBody->>ServerHandler: attach 'error' listener
ReadableBody->>Busboy: pipe() data
Busboy->>ServerHandler: emit file/fields events
ServerHandler->>ServerHandler: resolve Promise with parsed formData
end
rect rgba(255,220,220,0.35)
Note over ReadableBody,ServerHandler: If ReadableBody emits 'error'
ReadableBody-->>ServerHandler: 'error' (e.g., aborted)
ServerHandler-->>Client: reject Promise with error
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #38081 +/- ##
===========================================
+ Coverage 70.59% 70.64% +0.05%
===========================================
Files 3145 3145
Lines 108761 108772 +11
Branches 19570 19573 +3
===========================================
+ Hits 76780 76843 +63
+ Misses 29967 29917 -50
+ Partials 2014 2012 -2
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Proposed changes (including videos or screenshots)
This PR addresses an issue where cancelling a file upload would cause an
UnCaughtException (Error: aborted / ECONNRESET)on the server.Introduced here: #37550
Issue(s)
Steps to test or reproduce
Further comments
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.
CORE-1606