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
Commit 558b301
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Fix prerendered Cloudflare pages rendering as [object Object] with nodejs_compat (#18011)
When workerd runs with nodejs_compat, Astro's isNode check returns true,
causing renderPage to pass an AsyncIterable body to the Response
constructor. Workerd's Response does not support this non-standard Node.js
extension and stringifies it to "[object Object]".
Add isWorkerd detection (via navigator.userAgent) and wrap the
AsyncIterable with ReadableStream.from() in workerd. This preserves the
faster AsyncIterable render path while producing a standard BodyInit type
that workerd accepts.
A previous fix (PR #16720) modified isNode to exclude workerd but was
reverted (PR #16997) because the renderToReadableStream fallback was
slower. This approach avoids that regression by keeping renderToAsyncIterable
and only wrapping the output.
Fixes#18009
Co-authored-by: factory[bot] <factory[bot]@users.noreply.github.com>
Co-authored-by: Matthew Phillips <[email protected]>
0 commit comments