You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bun serve with a Response with empty ReadableStream won't redirect. #15320
Bun.serve({port: process.env.NITRO_PORT||process.env.PORT||3e3,websocket: void0,asyncfetch(req,server2){consturl=newURL(req.url);if(url.pathname==="/redirect"){constemptyStream=newReadableStream({start(controller){// Immediately close the stream to make it emptycontroller.close();}});returnnewResponse(emptyStream,{status: 307,headers: {location: "/"}});}returnnewResponse("Hello world");}});
navigate to localhost:3000/redirect
Nothing will happen, the response the browser receives is empty (no headers or body) and no redirect.
What is the expected behavior?
It should redirect to / and show Hello world in the browser.
What do you see instead?
White screen, because the response contains no body or headers.
As context, this breaks new TanStack Starts framework, basically when using Bun all redirects will do nothing and an empty page will be rendered. TanStack/router#2819
Reacted by Fitim Bytyqi, Austin, Lukas Frey and Anton Kuznetsov
Any updates on this? I'm still blocked on using bun on Production due to this. Any TanStack Start project which does a redirect will be impacted by this.
Activity
adrifer commentedon Nov 21, 2024
As context, this breaks new TanStack Starts framework, basically when using Bun all redirects will do nothing and an empty page will be rendered. TanStack/router#2819
adrifer commentedon Apr 1, 2025
Any updates on this? I'm still blocked on using bun on Production due to this. Any TanStack Start project which does a redirect will be impacted by this.
adrifer commentedon Apr 1, 2025
Thanks a lot @cirospaciari for taking the time to try to fix this!! I really appreciate it!