cloudflare / cloudflare/workers-sdk

🐛 BUG: TypeError: This ReadableStream did not return bytes when using a trpc with SSE

Open
#7,686 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.5k
Forks
1.5k
Avg merge
3d 8h
Merged PRs (30d)
186

Description

### Which Cloudflare product(s) does this pertain to?

Workers for Platforms

### What versions are you using?

Node: 22.12.0, Wrangler 3.99.0

### What operating system and version are you using?

macOS 14.0

### Please provide a link to a minimal reproduction

https://github.com/dandoen/cloudflare-trpc-subscription

### Describe the Bug

Following the example implementation of a basic SSE, deployed to the Cloudflare runtime I'm getting "TypeError: This ReadableStream did not return bytes"

This happens both locally and in deployed environment. It's unclear where the error is being thrown from and/or how I should be handling it.

### Please provide any relevant error logs

```
workerd/io/worker.c++:1017: info: console warning; message = A promise rejection was handled asynchronously. This warning occurs when attaching a catch handler to a promise after it rejected. (rejection #18)
workerd/io/worker.c++:2082: info: uncaught exception; source = Uncaught (in promise); stack = TypeError: This ReadableStream did not return bytes.
workerd/io/worker.c++:2082: info: uncaught exception; source = Uncaught (in response); stack = TypeError: This ReadableStream did not return bytes.
workerd/io/worker-entrypoint.c++:372: info: exception = workerd/jsg/_virtual_includes/jsg/workerd/jsg/value.h:1372: failed: remote.jsg.TypeError: This ReadableStream did not return bytes.
stack: 104b5993b 104b50e14 104b51c8f 1068fa0e3 1049faaf0 1049faebc 1049fc0d8 1049fcacc 104a5b6b7 10445bd60 105383337 1068fa0e3 105381f70 10445bd60 104b51044 104b5145b 1068fa0e3 1049fc2c8 1049fcacc
workerd/server/server.c++:3898: error: Uncaught exception: workerd/jsg/_virtual_includes/jsg/workerd/jsg/value.h:1372: failed: remote.jsg.TypeError: This ReadableStream did not return bytes.
stack: 104b5993b 104b50e14 104b51c8f 1068fa0e3 1049faaf0 1049faebc 1049fc0d8 1049fcacc 104a5b6b7 10445bd60 105383337 1068fa0e3 105381f70 10445bd60 104b51044 104b5145b 1068fa0e3 1049fc2c8 1049fcacc 1044b9fa7 1053936a3 1053946bf 1053950f7 105367e80
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE {
method: 'Runtime.exceptionThrown',
params: {
timestamp: 1736235620722,
exceptionDetails: {
exceptionId: 17,
text: 'Uncaught (in promise)',
lineNumber: 0,
columnNumber: -2,
url: 'undefined',
exception: [Object],
executionContextId: 321189153
}
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.