Websocket error using alternative server framework
See original GitHub issueVersion
@nuxt/content: 1.3.2 nuxt: 2.12.2
Reproduction Link
https://github.com/mikeburgh/nuxt-hapi-content Created with npx create-nuxt-app -selecting hapi as the server framework -then adding in the @nuxt/content module
Steps to reproduce
Clone repo Run npm run dev Browse to : http://localhost:3000
What is Expected?
No errors in the console
What is actually happening?
Console is showing an error
ERROR Cannot read property 'length' of undefined 20:57:36
at WebSocket.setSocket (node_modules/@nuxt/content/node_modules/ws/lib/websocket.js:165:14)
at WebSocketServer.completeUpgrade (node_modules/@nuxt/content/node_modules/ws/lib/websocket-server.js:322:8)
at WebSocketServer.handleUpgrade (node_modules/@nuxt/content/node_modules/ws/lib/websocket-server.js:245:10)
at WS.handleUpgrade (node_modules/@nuxt/content/lib/ws.js:21:21)
at WS.serve (node_modules/@nuxt/content/lib/ws.js:17:10)
at node_modules/@nuxt/content/lib/middleware.js:11:15
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at next (node_modules/connect/index.js:161:14)
at WebpackBundler.middleware (node_modules/@nuxt/webpack/dist/webpack.js:5410:5) (repeated 1 times)
The error seems to be caused by the serve method in @nuxt/content/lib/ws.js and happens with both Hapi and express frameworks.
serve (req) {
this.handleUpgrade(req, req.socket, undefined)
}
Changing the undefined to an empty array solves it, although not sure if head should actually be something ? Happy to send a PR if head just needs to be an empty array ?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:16 (2 by maintainers)
Top Results From Across the Web
25. WebSocket Support - Spring
This part of the reference documentation covers Spring Framework's support for WebSocket-style messaging in web applications including use of STOMP as an ...
Read more >Server-Sent Events: the alternative to WebSockets you should ...
WebSockets are the most used technology for real-time web apps. However, Server Sent Events (SSE) are a simpler alternative that is often ...
Read more >WebSocket (ASGI Only) — Falcon 3.1.1 documentation
Error Types. Options. Falcon builds upon the ASGI WebSocket Specification to provide a simple, no-nonsense WebSocket server implementation. With support for ...
Read more >How to send error in websocket? - Sanic Community Discussion
Gets a close event from the server with a code 1011. Ideally, and instead, what would be good is : Connects; Gets an...
Read more >Using Spring Boot for WebSocket Implementation with STOMP
The most common alternatives are long polling and server-sent events. Let's look at how to implement WebSockets with the Spring Boot framework, and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have a similar problem
I’m having that issue without an alternative server framework. I’m using nuxt defaults