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: RangeError: Invalid WebSocket frame: invalid status code 22373 #585

Closed
briannhinton opened this issue Jun 30, 2021 · 7 comments
Closed

Comments

@briannhinton
Copy link
Contributor

What package manager are you using?

npm

What operating system are you using?

Mac OS Monterey

Describe the Bug

Server fails with the following error

/Users/{useraccount}/Documents/astro-blog/node_modules/snowpack/lib/index.js:159035
          return error$1(RangeError, `invalid status code ${code}`, true, 1002);
                 ^
RangeError: Invalid WebSocket frame: invalid status code 22373
    at Receiver.controlMessage (/Users/brianhinton/Documents/astro-blog/node_modules/snowpack/lib/index.js:159035:18)
    at Receiver.getData (/Users/brianhinton/Documents/astro-blog/node_modules/snowpack/lib/index.js:158921:42)
    at Receiver.startLoop (/Users/brianhinton/Documents/astro-blog/node_modules/snowpack/lib/index.js:158714:22)
    at Receiver._write (/Users/brianhinton/Documents/astro-blog/node_modules/snowpack/lib/index.js:158649:10)
    at writeOrBuffer (node:internal/streams/writable:389:12)
    at _write (node:internal/streams/writable:330:10)
    at Receiver.Writable.write (node:internal/streams/writable:334:10)
    at Socket.socketOnData (/Users/brianhinton/Documents/astro-blog/node_modules/snowpack/lib/index.js:160778:37)
    at Socket.emit (node:events:394:28)
    at addChunk (node:internal/streams/readable:312:12)
    at readableAddChunk (node:internal/streams/readable:287:9)
    at Socket.Readable.push (node:internal/streams/readable:226:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
error Command failed with exit code 1.

Steps to Reproduce

  1. npm init astro astro-blog
  2. npm i
  3. yarn start
  4. Open http://127.0.0.1:3000/
  5. Navigate to another page
  6. The server fails with the error noted above

Link to Minimal Reproducible Example (Optional)

No response

@briannhinton
Copy link
Contributor Author

Workarounds

Use Firefox or Chrome to load the server

Disable Develop / Experimental / NSURLSession WebSocket in Safari

@FredKSchott FredKSchott changed the title 🐛 RangeError: Invalid WebSocket frame: invalid status code 22373 🐛 BUG: RangeError: Invalid WebSocket frame: invalid status code 22373 Jun 30, 2021
@natemoo-re
Copy link
Member

Two thoughts here!

  1. I'm not familiar with NSURLSession but we should try to figure out if we're doing something wrong here.
  2. This is probably more of a Snowpack issue than an Astro one!

@jasikpark
Copy link
Contributor

@matthewp
Copy link
Contributor

I was able to recreate. I can find almost no information about this bug online though, which is pretty bizarre.

@jasikpark
Copy link
Contributor

Yeah, you can also replicate by enabling the experimental NSUrlSession flag in Safari on macOS Bug Sur

@matthewp
Copy link
Contributor

This appears to be a bug in Safari, they are not sending the right status code: websockets/ws#1922

Going to wait and see if we get more information on that.

@matthewp
Copy link
Contributor

Did some more research and this is indeed a Safari bug. They are not sending the status code as part of the close frame. As this is a bug in an experimental feature that is disabled by default, I'm going to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants