Uncaught (in response) Error: The script will never generate a response

Hi all,

I get the below error when a WebSocket client gets disconnected:
✘ [ERROR] Uncaught (in response) Error: The script will never generate a response.

My Workers code is super minimal (a sample code I found online):

export default {
	fetch(request) {
	  const [client, server] = Object.values(new WebSocketPair());
  
	  server.accept();
	  server.addEventListener("message", (event) => {
		server.send(event.data);
	  });
  
	  return new Response(null, {
		status: 101,
		webSocket: client,
	  });
	},
  };

Any advise would be really appreciated!