Unexpected end of JSON ( How to use Durable Objects with next-on-pages? )
I am trying to use Durable Objects with next-on-pages. From my understanding, Durable Objects cannot be used directly with next-on-pages, they must be created in a separate worker and bound to that worker.
I created a separate worker from the page and it now works on its own. However, when I call it with the page, I get an error.
3 Replies
src/index.mjs
src/app/api/users/profiles/websocket
I tried binding the DurableObject directly, but I still get the same error.
aaa
bbb
101
[wrangler:err] SyntaxError: Unexpected end of JSON input
[wrangler:err] TypeError: Web Socket request did not return status 101 Switching Protocols response with Web Socket
[wrangler:inf] GET /api/users/profiles/websocket 500 Internal Server Error (68ms)
just had the same issue... check your wrangler.toml, you probably don't have WEBSOCKET set for the name like:
[[durable_objects.bindings]]
name = "WEBSOCKET"