luixaviles / luixaviles/socket-io-typescript-chat

Node v14.2.0 Errors in server

Open
#57 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
825
Forks
270
PR merge metrics
No merged PRs in 30d

Description

Hello. I have created an application from your example and the express server keeps crashing and restarting when a `socket.on` event happens. This may be a false alarm and a bug in my application, but if anyone could help me decipher the error message, that would be great.
**~/.pm2/pm2.log**
```
2020-05-12T14:58:22: PM2 error: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (7679)
at Object.writeFileSync (fs.js:1380:5)
at /usr/lib/node_modules/pm2/lib/God/ForkMode.js:264:12
at wrapper (/usr/lib/node_modules/pm2/node_modules/async/internal/once.js:12:16)
at next (/usr/lib/node_modules/pm2/node_modules/async/waterfall.js:96:20)
at /usr/lib/node_modules/pm2/node_modules/async/internal/onlyOnce.js:12:16
at WriteStream. (/usr/lib/node_modules/pm2/lib/Utility.js:186:13)
at WriteStream.emit (events.js:315:20)
at WriteStream.EventEmitter.emit (domain.js:547:15)
at internal/fs/streams.js:395:12
at FSReqCallback.oncomplete (fs.js:163:23)

```
My "chat-server.ts" : https://github.com/xinthose/angular_cpp_websocket/blob/master/server/src/portalogic-server.ts
Target: `es2019`
OS: Ubuntu 18.04 LTS

This may be a bug with express or socket-io with node v14? I do not have problems with node v13.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with server/src/portalogic-server.ts and the attached PM2 log, focusing on the socket.on event and the Node v14 stack trace. Compare the behavior with Node v13 as reported, then reproduce the server crash and determine whether the issue is in the example application or its Express/socket handling. Done means the cause is identified and the server no longer crashes and restarts on that event.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, nodejs, typescript
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.