Skip to content

fix(edge-converter): Ensure null body status codes dont return a body #906

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

Merged
merged 4 commits into from
Jun 17, 2025

Conversation

sommeeeer
Copy link
Contributor

@sommeeeer sommeeeer commented Jun 17, 2025

For opennextjs/opennextjs-cloudflare#684

We need to ensure that the response doesn't return a body if its a status code that does not allow it. (101, 204, 205, 304).

Here is a reproduction I made for that issue. To run the reproduction just pnpm install && pnpm preview. Then in another terminal you curl -i http://localhost:8787/src2.

We could fix this inside the overrides/proxyExternalRequest/fetch.ts aswell. We would just return the body as is, and not fallback to emptyReadableStream(). Not sure what would be preferred? I dont think emptyReadableStream() has any effect in this converter.

Copy link

changeset-bot bot commented Jun 17, 2025

🦋 Changeset detected

Latest commit: e14a354

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@opennextjs/aws Patch
app-pages-router Patch
app-router Patch

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

Copy link

pkg-pr-new bot commented Jun 17, 2025

Open in StackBlitz

pnpm add https://pkg.pr.new/@opennextjs/aws@906

commit: e14a354

Copy link
Contributor

@conico974 conico974 left a comment

Choose a reason for hiding this comment

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

Just one little change and it should be good

Co-authored-by: conico974 <nicodorseuil@yahoo.fr>
@sommeeeer sommeeeer requested a review from conico974 June 17, 2025 16:18
Copy link
Contributor

@conico974 conico974 left a comment

Choose a reason for hiding this comment

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

LGTM Thanks

@conico974 conico974 merged commit c5421fa into opennextjs:main Jun 17, 2025
3 checks passed
@sommeeeer sommeeeer deleted the fix-fetch-proxy-null-body branch June 17, 2025 16:43
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