Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sveltekit): Avoid request body double read errors #15368

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Feb 11, 2025

This PR attempts to fix an unreproducible bug reported in #14583: It seems like our SDK calling clone on the request object passed to SvelteKit request handlers causes double read errors when the request body is consumed in user code.

While I'm not sure about this, my best guess is that it has something to do with SvelteKit creating a new request object from the actual incoming request in a special way.

This PR removes the clone() call (tests would fail if it was still called) from our request handler. This is safe because our SDK does not consume the request body. Cloning here was a precautionary measure that apparently backfired.
If it turns out that this doesn't fix the problem, we should revert this PR.

@Lms24 Lms24 self-assigned this Feb 11, 2025
@Lms24 Lms24 requested review from lforst and andreiborza February 11, 2025 10:23
@Lms24 Lms24 merged commit bb12dff into develop Feb 11, 2025
35 checks passed
@Lms24 Lms24 deleted the lms/fix-sveltekit-dont-clone-request branch February 11, 2025 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants