Fix response body stream already read error in content submission - #117
Merged
github-actions[bot] merged 1 commit intoOct 8, 2025
Merged
Conversation
- Clone response before attempting to read as both JSON and text - Add proper error handling for both JSON and text parsing failures - Resolves 'Failed to execute text on Response: body stream already read' error - Prevents response body stream from being consumed multiple times The issue was that we were trying to read the response body twice: 1. First with response.json() (which failed) 2. Then with response.text() (which failed because stream was already consumed) Solution: Clone the response before attempting JSON parsing, so we can fall back to text parsing if JSON fails without consuming the original stream.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Collaborator
Author
|
/approve |
Contributor
|
🚀 Admin-Approved and Auto-Merged! |
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.
🔧 Fix Response Body Stream Error
Problem
After PR #116 was merged, a new error appeared: "Failed to execute 'text' on 'Response': body stream already read". This error occurs when trying to read the response body multiple times.
Root Cause
The error handling code was attempting to read the response body twice:
response.json()(which failed for non-JSON responses)response.text()(which failed because the stream was already consumed)Solution
Technical Changes
Files Changed
github-auth.js- Fixed response body stream handling in createPullRequest methodImpact
Testing