Open
Description
Issue Description
When adding Apollo client to a react-router v7 app with SSR, the following error is encountered when handling the server side request:
Unexpected Server Error
TypeError [ERR_INVALID_STATE]: Invalid state: ReadableStream is locked
Link to Reproduction
https://stackblitz.com/~/github.com/craigsmitham/react-router-apollo-client
Reproduction Steps
See stackblitz and github repo for more details.
This repro case was created by:
- Creating a new react-router app
npx create-react-router@latest react-router-apollo-client
- Revealing the server entry point by running
npx react-router reveal
- Updating revealed server entry point
entry.server.tsx
based on guidance for Remix in https://www.apollographql.com/blog/how-to-use-apollo-client-with-remix
To reproduce the issue, simply run npm run dev
and visit dev server http://localhost:5173 and observe the following error:
Unexpected Server Error
TypeError [ERR_INVALID_STATE]: Invalid state: ReadableStream is locked
More information:
This error appears to be triggered when the getDataFromTree(App)
line is called: https://github.com/craigsmitham/react-router-apollo-client/blob/1cb7514b7403a456bc141ef1e5b658e1cfb13b91/app/entry.server.tsx#L44C1-L44C32
@apollo/client
version
3.12.4