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

Crash: request is not acceptable in server #11

Open
LuisMayo opened this issue Oct 13, 2020 · 4 comments
Open

Crash: request is not acceptable in server #11

LuisMayo opened this issue Oct 13, 2020 · 4 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@LuisMayo
Copy link

Hi and thanks for this library, it really ease things up.

I have detected that when you use WebSocketServer and go and try to establish an HTTP connection to the websocket port the server crashes and closes.

While I obviously don't expect the WS server to work properly when being contacted by the wrong protocol it should fail silently, or at least, allow the programmer to specify an error callback in case things like this occur.

I know that the error is indeed generated by Deno's std library ws. However I think if possible it should be handled here.

Steps to reproduce

  1. deno run --allow-net https://deno.land/x/[email protected]/example/server.ts
  2. Open http://localhost:8080/
  3. Now the server has crashed

Thanks.

@ryo-ma
Copy link
Owner

ryo-ma commented Oct 14, 2020

Thank you for your issue.

OK. I will support it.

@ryo-ma ryo-ma added good first issue Good for newcomers help wanted Extra attention is needed labels Oct 20, 2020
@Josema
Copy link

Josema commented Jun 20, 2021

Same issue here. It makes the app crashes.

error: Uncaught (in promise) Error: request is not acceptable
  throw new Error("request is not acceptable");
        ^
    at acceptWebSocket (https://deno.land/[email protected]/ws/mod.ts:453:9)
    at WebSocketServer.connect (https://deno.land/x/[email protected]/lib/websocket.ts:35:28)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `sh run.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2021-06-20T16_17_35_643Z-debug.log

@UserJHansen
Copy link
Contributor

You can just do something like:
WebsocketServer.on("error", console.log)
That will catch all errors like this and just log them to console,

@Josema
Copy link

Josema commented Aug 27, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants