SSR streaming is throwing error
Describe the bug
I'm having this error in my console when trying to setup and run the basic-ssr-streaming-file-based example:
Error: React currently only supports piping to one writable stream. The example on Stackblitz is also seems to be broken with this error message: Upgrade Required
Your Example Website or App
https://stackblitz.com/github/tanstack/router/tree/main/examples/react/basic-ssr-streaming-file-based?embed=1&theme=dark&preset=node&file=src/main.tsx
Steps to Reproduce the Bug or Issue
- Clone the project and do the setup following by the provided guide from Tanstack Router repository
- Run the project
Expected behavior
The URLs got served normally
Screenshots or Videos
Platform
- OS: MacOS 13.2.1, M1 Chip
- Browser: Chrome
- Version: 125.0.6422.114
Additional context
No response
Any update on this issue? wanted to try the examples out myself before commiting to anything and this not allowing me to do so
@TkDodo @tannerlinsley can you please take a look at the example when you have time? Much appreciate it :D
Weird because I have even more basic problems with that example. First, request seems to be incorrectly passed as req (see also createRequestHandler type):
file:///C:/Users/sh4dow/temp/basic-ssr-streaming-file-based/node_modules/@tanstack/start/dist/esm/server/createRequestHandler.js:18
const url = new URL(request.url, "http://localhost");
^
TypeError: Cannot read properties of undefined (reading 'url')
at file:///C:/Users/sh4dow/temp/basic-ssr-streaming-file-based/node_modules/@tanstack/start/dist/esm/server/createRequestHandler.js:18:33
at Module.render (C:/Users/sh4dow/temp/basic-ssr-streaming-file-based/src/entry-server.tsx:15:5)
at file:///C:/Users/sh4dow/temp/basic-ssr-streaming-file-based/server.js:76:13
But after correcting that, there's another error. Apparently, the express request object isn't compatible (which typescript complains about as well):
file:///C:/Users/sh4dow/temp/basic-ssr-streaming-file-based/node_modules/@tanstack/start/dist/esm/server/defaultStreamHandler.js:40
...isbot(request.headers.get("User-Agent")) ? {
^
TypeError: request.headers.get is not a function
at defaultStreamHandler (file:///C:/Users/sh4dow/temp/basic-ssr-streaming-file-based/node_modules/@tanstack/start/dist/esm/server/defaultStreamHandler.js:40:34)
at file:///C:/Users/sh4dow/temp/basic-ssr-streaming-file-based/node_modules/@tanstack/start/dist/esm/server/createRequestHandler.js:30:12
(Also, dependencies for React, React DOM types (which causes a ton of jsx type errors) and arguably typescript are missing.)
can config issue example doesnt work
This is resolved as part of #4495. New docs is pending #4527