Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dandoen opened this issue Jan 7, 2025 · 1 comment
Labels
bug Something that isn't working

Comments

@dandoen
Copy link

dandoen commented Jan 7, 2025

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
    }
  }
}
@dandoen dandoen added the bug Something that isn't working label Jan 7, 2025
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Jan 7, 2025
@dandoen
Copy link
Author

dandoen commented Jan 7, 2025

Do note, I'm suspecting this is a bug on the Cloudflare side because running the router as an http server works just fine

import { createHTTPServer } from '@trpc/server/adapters/standalone';

// in https://github.com/dandoen/cloudflare-trpc-subscription/blob/master/src/index.ts#L21
createHTTPServer({
	router,
	createContext() {
		return {};
	},
}).listen(2022);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
Status: Untriaged
Development

No branches or pull requests

1 participant