Sveltekit节点流不再支持
由于node-fetch
被undiCi
在#5117 我们中的一些人遇到了错误
不再支持节点流 - 使用readableStream
不容易复制,因为我的错误仅在生产中发生。
如果您有同样的问题,这是一个自我解决的问题。
Since node-fetch
was replaced by undici
in #5117 some of us encountered the error
Node streams are no longer supported — use a ReadableStream instead
like in this post
It is not easy to reproduce, for me the error occured only in production.
This is a self-answered question in case you have the same problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
The error comes from
对我来说,问题是我的
endpoint.ts
直接返回fetch
。这曾经工作,但不再工作,因为
fetch
响应是一个复杂的对象,具有_ReadableState
属性。要解决此问题,您必须消耗响应并返回一个更简单的对象The error comes from src/runtime/server/utils.js L46 and is thrown after checking the
_readableState
property and some type on the response body of the request.For me the problem was that my
endpoint.ts
was returning thefetch
directly.This used to work but not anymore since the
fetch
response is a complex object with the_readableState
property. To fix this you have to consume the response and return a simpler object like