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

lib/parser.js formatPRIVMSG: Cannot read property 'split' of undefined #34

Open
TheBlackParrot opened this issue Apr 3, 2018 · 9 comments

Comments

@TheBlackParrot
Copy link

TheBlackParrot commented Apr 3, 2018

C:\Users\TheBlackParrot\Documents\Share\twitch-plays-bj2\node_modules\twitch-bot\lib\parser.js:33
    parsed.username = username.split('!')[0]
                               ^

TypeError: Cannot read property 'split' of undefined
    at Object.formatPRIVMSG (C:\Users\TheBlackParrot\Documents\Share\twitch-plays-bj2\node_modules\twitch-bot\lib\parser.js:33:32)
    at TLSSocket.irc.on.data (C:\Users\TheBlackParrot\Documents\Share\twitch-plays-bj2\node_modules\twitch-bot\lib\bot.js:77:32)
    at emitOne (events.js:116:13)
    at TLSSocket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:246:13)
    at TLSSocket.Readable.push (_stream_readable.js:208:10)
    at TLSWrap.onread (net.js:607:20)
@PBug90
Copy link
Contributor

PBug90 commented Apr 6, 2018

Any chance to get more information about the version and the input that failed to be parsed?

@kritzware
Copy link
Owner

Any updates on this @TheBlackParrot ?

@TheBlackParrot
Copy link
Author

Haven't seen it happen again recently, and I had no logs at the time. I've got it running under PM2 now so if it happens again I should be able to catch logs of what was going on.
Is there a debug output I can enable if it happens again?

@Buggitt
Copy link

Buggitt commented Jul 1, 2018

I had this happen today:

...\node_modules\twitch-bot\lib\parser.js:33
    parsed.username = username.split('!')[0]
                               ^

TypeError: Cannot read property 'split' of undefined
    at Object.formatPRIVMSG (C:\...\node_modules\twitch-bot\lib\parser.js:33:32)
    at TLSSocket.irc.on.data (C:\...\node_modules\twitch-bot\lib\bot.js:77:32)
    at emitOne (events.js:116:13)
    at TLSSocket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:246:13)
    at TLSSocket.Readable.push (_stream_readable.js:208:10)
    at TLSWrap.onread (net.js:597:20)

I got this error when someone "raided" (fucntionality of twitch) my stream, hopfuly this info is helpful.

@kritzware
Copy link
Owner

What version of the bot are you using? You can find out this information by looking at the version no. in your package.json file of your project.

@Buggitt
Copy link

Buggitt commented Jul 2, 2018

@kritzware Version 1.2.5

@hayesmaker
Copy link

hayesmaker commented Aug 30, 2018

I get the same error when anyone hosts me

version: "twitch-bot": "^1.2.5"

node_modules\twitch-bot\lib\parser.js:33
    parsed.username = username.split('!')[0]
                               ^

TypeError: Cannot read property 'split' of undefined
    at Object.formatPRIVMSG (D:\hayesmaker\Workspace\twitch\chillstrim\chillstri                           m-server\node_modules\twitch-bot\lib\parser.js:33:32)
    at TLSSocket.irc.on.data (D:\hayesmaker\Workspace\twitch\chillstrim\chillstr                           im-server\node_modules\twitch-bot\lib\bot.js:77:32)
    at emitOne (events.js:116:13)
    at TLSSocket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:246:13)
    at TLSSocket.Readable.push (_stream_readable.js:208:10)
    at TLSWrap.onread (net.js:597:20)

@mrov
Copy link

mrov commented Nov 6, 2018

Same error here "version": "1.2.5"

@Dandrum
Copy link

Dandrum commented Oct 26, 2019

server_1    |     parsed.username = username.split('!')[0]
server_1    |                                ^
server_1    |
server_1    | TypeError: Cannot read property 'split' of undefined
server_1    |     at Object.formatPRIVMSG (/app/node_modules/twitch-bot/lib/parser.js:33:32)
server_1    |     at TLSSocket.<anonymous> (/app/node_modules/twitch-bot/lib/bot.js:76:32)
server_1    |     at TLSSocket.emit (events.js:210:5)
server_1    |     at addChunk (_stream_readable.js:308:12)
server_1    |     at readableAddChunk (_stream_readable.js:285:13)
server_1    |     at TLSSocket.Readable.push (_stream_readable.js:223:10)
server_1    |     at TLSWrap.onStreamRead (internal/stream_base_commons.js:182:23)```

Has the same issiue and whole node crashed on it......

Just check after split if there is an index 0 not get it straight.
For simple fix try ```parsed.username = username.split('!')[0] || ''`
Or set parsed.username default to = '' (empty String)

I will try to fix it when i got more time...

Best Dan

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

7 participants