Git Product home page Git Product logo

Comments (7)

hoon avatar hoon commented on August 10, 2024

I too am experiencing this error while using irc-message through twitch-irc.

The full trace of the error is:

[18:42:21] error  - TypeError: Cannot read property 'tags' of null
    at DestroyableTransform._transform (/Users/hoon/Workspace/ppr/node_modules/twitch-irc/node_modules/irc-message/index.js:148:35)
    at DestroyableTransform.Transform._read (/Users/hoon/Workspace/ppr/node_modules/twitch-irc/node_modules/irc-message/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (/Users/hoon/Workspace/ppr/node_modules/twitch-irc/node_modules/irc-message/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
    at doWrite (/Users/hoon/Workspace/ppr/node_modules/twitch-irc/node_modules/irc-message/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:237:10)
    at writeOrBuffer (/Users/hoon/Workspace/ppr/node_modules/twitch-irc/node_modules/irc-message/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:227:5)
    at DestroyableTransform.Writable.write (/Users/hoon/Workspace/ppr/node_modules/twitch-irc/node_modules/irc-message/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:194:11)
    at Socket.ondata (_stream_readable.js:540:20)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
    at Socket.Readable.push (_stream_readable.js:126:10)
    at TCP.onread (net.js:538:20)

from irc-message.

Latrasis avatar Latrasis commented on August 10, 2024

Same, happens during a client reload or close.

from irc-message.

Latrasis avatar Latrasis commented on August 10, 2024

Here's a temporary hack I made on ./index.js:

var stream = through.obj(function(chunk, encoding, done) {

        buffer += chunk.toString()
        messages = buffer.split(/\r\n/)
        buffer = messages.pop()


        // TEMP FIX FOR CRASHING
        // by Jacob on August 6th, 2015

        for (var i = 0; i < messages.length; i++) {
            var message = messages[i]
            var parsed = parse(message)

            // support for IRCv3.2 server-time spec
            var timestamp = parsed ? parsed.tags.time : null;

            if (parsed && convertTimestamps) {
                var converted = iso8601.toDate(timestamp)
                parsed.tags.time = (converted) ? converted : new Date(NaN)
            }
            if (parsed && shouldParsePrefix) {
                parsed.prefix = parsePrefix(parsed.prefix)
            }
            if (parsed === null) {
                // Ignore Message If Parsed is Invalid
                // Don't Emit Error, due to Crash

                // this.emit('error', new Error('Invalid IRC message'))
            } else {
                this.push(parsed)
            }

        }

        done()
    })

from irc-message.

osslate avatar osslate commented on August 10, 2024

Could you please send in a pull request and add tests? Thank you!

On Fri, Aug 7, 2015 at 12:15 AM Jacob Payne [email protected]
wrote:

Here's a temporary hack I made on ./index.js:

var stream = through.obj(function(chunk, encoding, done) {

    buffer += chunk.toString()
    messages = buffer.split(/\r\n/)
    buffer = messages.pop()


    // TEMP FIX FOR CRASHING
    // by Jacob on August 6th, 2015

    for (var i = 0; i < messages.length; i++) {
        var message = messages[i]
        var parsed = parse(message)

        // support for IRCv3.2 server-time spec
        var timestamp = parsed ? parsed.tags.time : null;

        if (parsed && convertTimestamps) {
            var converted = iso8601.toDate(timestamp)
            parsed.tags.time = (converted) ? converted : new Date(NaN)
        }
        if (parsed && shouldParsePrefix) {
            parsed.prefix = parsePrefix(parsed.prefix)
        }
        if (parsed === null) {
            // Ignore Message If Parsed is Invalid
            // Don't Emit Error, due to Crash

            // this.emit('error', new Error('Invalid IRC message'))
        } else {
            this.push(parsed)
        }

    }

    done()
})


Reply to this email directly or view it on GitHub
#18 (comment).

from irc-message.

xingped avatar xingped commented on August 10, 2024

Is the code an appropriate permanent fix though? He did mention it was a
temporary hack.
On Aug 7, 2015 11:46 AM, "Fionn Kelleher" [email protected] wrote:

Could you please send in a pull request and add tests? Thank you!

On Fri, Aug 7, 2015 at 12:15 AM Jacob Payne [email protected]
wrote:

Here's a temporary hack I made on ./index.js:

var stream = through.obj(function(chunk, encoding, done) {

buffer += chunk.toString()
messages = buffer.split(/\r\n/)
buffer = messages.pop()

// TEMP FIX FOR CRASHING
// by Jacob on August 6th, 2015

for (var i = 0; i < messages.length; i++) {
var message = messages[i]
var parsed = parse(message)

// support for IRCv3.2 server-time spec
var timestamp = parsed ? parsed.tags.time : null;

if (parsed && convertTimestamps) {
var converted = iso8601.toDate(timestamp)
parsed.tags.time = (converted) ? converted : new Date(NaN)
}
if (parsed && shouldParsePrefix) {
parsed.prefix = parsePrefix(parsed.prefix)
}
if (parsed === null) {
// Ignore Message If Parsed is Invalid
// Don't Emit Error, due to Crash

// this.emit('error', new Error('Invalid IRC message'))
} else {
this.push(parsed)
}

}

done()
})


Reply to this email directly or view it on GitHub
<#18 (comment)
.


Reply to this email directly or view it on GitHub
#18 (comment).

from irc-message.

osslate avatar osslate commented on August 10, 2024

Seems to be an error with logging into npm at the moment, I'll try publish it later.

from irc-message.

osslate avatar osslate commented on August 10, 2024
% npm publish
+ [email protected]

from irc-message.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.