T
TanStack5mo ago
genetic-orange

Error reading routerStream

After I have updated to latest versions of Start, this error came up, and somehow even after downgrading back to 1.125.4, it is still there:
VITE v6.3.5 ready in 2643 ms

Local: http://localhost:3000/
Network: http://172.31.0.4:3000/
press h + enter to show help
[vite] connected.
Error reading routerStream: 8 | - For more information, please check the "cause" property of this error.
9 | - If you believe this is an error in Seroval, please submit an issue at https://github.com/lxsmnsyc/seroval/issues/new`:`Seroval caught an error during the ${o} process.
10 |
11 | "${_e.call(e)}"
12 |
13 | For more information, please check the "cause" property of this error.`}var ee=class extends Error{constructor(r,t){super(Er(r,t));this.cause=t}},E=class extends ee{constructor(e){super("parsing",e)}},Te=class extends ee{constructor(e){super("serialization",e)}},ze=class extends ee{constructor(e){super("deserialization",e)}},g=class extends Error{constructor(r){super(`The value ${_e.call(r)} of type "${typeof r}" cannot be parsed/serialized.

error: The value [object Object] of type "object" cannot be parsed/serialized.

There are few workarounds for this problem:
- Transform the value in a way that it can be serialized.
- If the reference is present on multiple runtimes (isomorphic), you can use the Reference API to map the references.
value: Tag {
$$mdtype: "Tag",
name: "Document",
attributes: [Object ...],
children: [
[Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...]
],
},

at new g (/app/node_modules/seroval/dist/esm/production/index.mjs:13:365)
at parseObject (/app/node_modules/seroval/dist/esm/production/index.mjs:17:31059)
at parseProperties (/app/node_modules/seroval/dist/esm/production/index.mjs:17:32428)
...
VITE v6.3.5 ready in 2643 ms

Local: http://localhost:3000/
Network: http://172.31.0.4:3000/
press h + enter to show help
[vite] connected.
Error reading routerStream: 8 | - For more information, please check the "cause" property of this error.
9 | - If you believe this is an error in Seroval, please submit an issue at https://github.com/lxsmnsyc/seroval/issues/new`:`Seroval caught an error during the ${o} process.
10 |
11 | "${_e.call(e)}"
12 |
13 | For more information, please check the "cause" property of this error.`}var ee=class extends Error{constructor(r,t){super(Er(r,t));this.cause=t}},E=class extends ee{constructor(e){super("parsing",e)}},Te=class extends ee{constructor(e){super("serialization",e)}},ze=class extends ee{constructor(e){super("deserialization",e)}},g=class extends Error{constructor(r){super(`The value ${_e.call(r)} of type "${typeof r}" cannot be parsed/serialized.

error: The value [object Object] of type "object" cannot be parsed/serialized.

There are few workarounds for this problem:
- Transform the value in a way that it can be serialized.
- If the reference is present on multiple runtimes (isomorphic), you can use the Reference API to map the references.
value: Tag {
$$mdtype: "Tag",
name: "Document",
attributes: [Object ...],
children: [
[Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...]
],
},

at new g (/app/node_modules/seroval/dist/esm/production/index.mjs:13:365)
at parseObject (/app/node_modules/seroval/dist/esm/production/index.mjs:17:31059)
at parseProperties (/app/node_modules/seroval/dist/esm/production/index.mjs:17:32428)
...
versions are:
"@tanstack/react-router": "^1.127.3",
"@tanstack/react-router-with-query": "^1.127.3",
"@tanstack/react-start": "^1.127.7",
"@tanstack/react-router": "^1.127.3",
"@tanstack/react-router-with-query": "^1.127.3",
"@tanstack/react-start": "^1.127.7",
6 Replies
ambitious-aqua
ambitious-aqua5mo ago
same issue, had to downgrade: - @tanstack/react-router 1.127.3 + @tanstack/react-router 1.125.6 - @tanstack/react-start 1.127.7 + @tanstack/react-start 1.125.6
fascinating-indigo
fascinating-indigo5mo ago
what do you want to serialize here? which stuff are you trying trying to serialize here?
genetic-orange
genetic-orangeOP5mo ago
Looks like that was Markdoc stuff (the result of Markdoc.transform) that is returned from the server function. It contains some classes that don’t get serialized by default. The workaround for me was to use JSON.serialize in the server function and JSON.parse in my component. Not quite performant, I suppose, with quite big markdown document I have.
That was quite strange because it worked with the same versions of start before…
national-gold
national-gold5mo ago
I'm seeing a similar error when e.g. returning a getTitle function from beforeLoad. I've moved it out to a util function, but I'm curious if the pattern of returning a function from beforeLoad is no longer supported/recommended in Start apps. It worked prior to Start 1.27.x, but I'm curious whether it should work or not.
fascinating-indigo
fascinating-indigo5mo ago
it was never supported we will enable Serialization control for the lifecycle methods so you can decide whether to serialize the output on the server or not and then rerun on the client
flat-fuchsia
flat-fuchsia3mo ago
Im getting this same error, not sure where it comes from though

Did you find this page helpful?