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

Engine.io: Cannot read properties of undefined (reading 'end') error #4643

Closed
azju opened this issue Feb 28, 2023 · 4 comments
Closed

Engine.io: Cannot read properties of undefined (reading 'end') error #4643

azju opened this issue Feb 28, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@azju
Copy link

azju commented Feb 28, 2023

Describe the bug
We're sometimes seeing a very rare error while using uWebSockets.js (uws);

To Reproduce

It happens occasionally and can't reproduce locally

Socket.IO server version: 4.6.0

Expected behavior
No to see the error or this error gets handled gracefully.

Platform:

  • Client device: Unknown
  • Client OS: Unknown
  • Server: x86_64 & arm64 Alpine linux
  • Socket.IO version: 4.6.0
  • uWebSockets.js version: 20.19.0

Additional context
Cannot read properties of undefined (reading 'end')\nTypeError: Cannot read properties of undefined (reading 'end')\n at Polling.onDataRequest (/node_modules/engine.io/build/transports-uws/polling.js:104:51)\n at Polling.onRequest (/node_modules/engine.io/build/transports-uws/polling.js:47:18)\n at /node_modules/engine.io/build/userver.js:95:60\n at uServer.verify (/node_modules/engine.io/build/server.js:152:9)\n at /node_modules/engine.io/build/userver.js:82:18\n at /node_modules/engine.io/build/userver.js:74:13\n at /node_modules/engine.io/build/server.js:187:21\n at cors (/node_modules/cors/lib/index.js:188:7)\n at /node_modules/cors/lib/index.js:224:17\n at origin (/dist/socket.js:40:25)

@azju azju added the to triage Waiting to be triaged by a member of the team label Feb 28, 2023
darrachequesne added a commit to socketio/engine.io that referenced this issue May 1, 2023
The class used to accumulate the response headers did not expose the
exact same API as its wrapped type, which could lead to the following
error in some rare cases:

> TypeError: Cannot read properties of undefined (reading 'end')
>    at Polling.onDataRequest (build/transports-uws/polling.js:109:53)
>    at Polling.onRequest (build/transports-uws/polling.js:47:18)
>    at callback (build/userver.js:94:56)
>    at uServer.verify (build/server.js:152:9)

Related: socketio/socket.io#4643
@darrachequesne
Copy link
Member

I think I've found the culprit, this should be fixed by socketio/engine.io@8b22162, included in engine.io@6.4.2 and thus in socket.io@4.6.x.

Please reopen if needed.

@darrachequesne darrachequesne added bug Something isn't working and removed to triage Waiting to be triaged by a member of the team labels May 3, 2023
@joacub
Copy link

joacub commented May 22, 2023

socket.io

not, it does not fix that, also there is other error with uws

@dubisoft-solutions
Copy link

dubisoft-solutions commented Jul 20, 2023

we are facing a similar issues

TypeError: Cannot read property 'end' of undefined

at IncomingMessage.onData (/usr/local/readytech/acc-server/stage/node_modules/engine.io/build/transports/polling.js:128:35)
 at IncomingMessage.emit (events.js:197:13)
 at addChunk (_stream_readable.js:288:12)
 at readableAddChunk (_stream_readable.js:265:13)
 at IncomingMessage.Readable.push (_stream_readable.js:224:10)
 at HTTPParser.parserOnBody (_http_common.js:126:22)
Jul 20 08:07:58 dev-server systemd[1]: service: Main process exited, code=exited, status=1/FAILURE

@darrachequesne
Copy link
Member

For future readers:

The exception seems to come from this line:

res.writeHead(413).end();

Though I'm not sure how res.writeHead(413).end(); can result in TypeError: Cannot read property 'end' of undefined.

I do think the initial issue was fixed though. Please reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants