websocket request to durable object does not contain upgrade header

I have a weird issue.

I deployed a project using durable objects to namespace.name.workers.dev and setup a worker route to a domain (ie. example.com)

Everything works fine on the workers.dev domain, but when trying to connect to example.com it doesn't work with the error below. I've confirmed the browser is sending the header, but it's not being received by the fetch handler.

Worker tried to return a WebSocket in a response to a request which did not contain the header "Upgrade: websocket"."

function handleApiRequest (request: Request, env: Env) {
  const id = env.do.idFromName('default')
  const roomObject = env.do.get(id)
  return roomObject.fetch(request) // new Request(request.url, request) also does not work
}


does anyone know why this isnt working?
Was this page helpful?