Skip to content

Streaming breaks external rewrite #789

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

Closed
sommeeeer opened this issue Mar 20, 2025 · 0 comments · Fixed by #791
Closed

Streaming breaks external rewrite #789

sommeeeer opened this issue Mar 20, 2025 · 0 comments · Fixed by #791

Comments

@sommeeeer
Copy link
Contributor

sommeeeer commented Mar 20, 2025

im currently working on some more e2e for streaming. during working on that i found out that enabling streaming in pages-router will break this:

test("Rewrite to external image", async ({ request }) => {
const response = await request.get("/external-on-image");
expect(response.status()).toBe(200);
expect(response.headers()["content-type"]).toBe("image/png");
expect(validateMd5(await response.body(), EXT_PNG_MD5)).toBe(true);
});

it turns out that the headers is incorrect. the body is actually correct, but the headers from the response is not what it should be. same thing happens if i add the test to app-router aswell (which already has streaming enabled)

here is a reproduction of the problem. it seems to work with local build, but not once deployed to AWS. steps to reproduce:

# this will deploy to AWS with SST
pnpm install
pnpm sst:deploy

# i added a local opennext build that seems to work fine
pnpm opennextlocalbuild
# then visit http://localhost:3000/external-on-image
# however it seems that http://localhost:3000/opennextjs is broken locally. i guess its also related to headers

then go visit the /external-on-image, /opennextjs and /rewrite. they are all external rewrites. there is also a massive amount of headers on the response, so something with the headers is broken.

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 a pull request may close this issue.

1 participant