Giter Site home page Giter Site logo

state is undefined about duplexify HOT 11 OPEN

mafintosh avatar mafintosh commented on June 24, 2024
state is undefined

from duplexify.

Comments (11)

binarykitchen avatar binarykitchen commented on June 24, 2024

But Chrome tells me a different trace:

collectLogger.js:49 #videomail > TypeError: Cannot read property 'ended' of undefined
    at DestroyableTransform.Writable.write (https://videomail.io/js/main-36bb504261.min.js:15125:45)
    at Duplexify._write (https://videomail.io/js/main-36bb504261.min.js:9893:184)
    at doWrite (https://videomail.io/js/main-36bb504261.min.js:15019:135)
    at writeOrBuffer (https://videomail.io/js/main-36bb504261.min.js:15015:8)
    at Duplexify.Writable.write (https://videomail.io/js/main-36bb504261.min.js:15126:7)
    at writeStream (https://videomail.io/js/main-36bb504261.min.js:18666:195)
    at draw (https://videomail.io/js/main-36bb504261.min.js:18802:27)

Weird

from duplexify.

binarykitchen avatar binarykitchen commented on June 24, 2024

Using latest websocket-stream package, where Duplexify.Writable.write() is triggered

from duplexify.

binarykitchen avatar binarykitchen commented on June 24, 2024

Debugged more in Chrome. Problem is that part of code. state is undefined here.

Writable.prototype.write = function (chunk, encoding, cb) {
  var state = this._writableState;
  var ret = false;

  if (typeof encoding === 'function') {
    cb = encoding;
    encoding = null;
  }

  if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;

  if (typeof cb !== 'function') cb = nop;

  if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {
    state.pendingcb++;
    ret = writeOrBuffer(this, state, chunk, encoding, cb);
  }

  return ret;
};

from duplexify.

binarykitchen avatar binarykitchen commented on June 24, 2024

Socket is not destroyed, not ended yet. Using node v6.20 here.

from duplexify.

binarykitchen avatar binarykitchen commented on June 24, 2024

There is another weird thing: if I run my code locally, this does not happen. Only on my remote server upon deployment. Maybe a firewall issue?

from duplexify.

binarykitchen avatar binarykitchen commented on June 24, 2024

any advice?? would be good because it's breaking my site. thanks

from duplexify.

mcollina avatar mcollina commented on June 24, 2024

Can you reproduce it? You can try with wireshark to get a capture of the latest packet sent that triggers it.

from duplexify.

binarykitchen avatar binarykitchen commented on June 24, 2024

honestly, i have no idea how to reproduce - only happens on my remote server, not on my local server. and what exactly should i capture on wireshark? you can see it yourself, it's the site www.videomail.io - just hit on the record button and then that error happens every time :(

any quick advice would be very much appreciated - thanks

from duplexify.

binarykitchen avatar binarykitchen commented on June 24, 2024

@mcollina I found out, that this only happens when code is minified. Does not happen when not minified. I am minifying the client side code with gulp uglify like this

        .pipe(plugins.if(settings.server.minify.js, plugins.uglify({
            mangle: false, // because of angularjs :(

            // keep line breaks for easier locating of weird errors (temporary)
            output: {
                "beautify":     true, // Add new lines
                "indent_level": 0,    // Don't add indentation
                "indent_start": 0
            }
        })))

from duplexify.

binarykitchen avatar binarykitchen commented on June 24, 2024

@mcollina to reproduce I guess you try to uglify some code that uses Duplexify and then see how it goes

from duplexify.

giulianok avatar giulianok commented on June 24, 2024

I'm having the same issue when I use sails and google-storage. If I disable sails, Google Storage works perfectly.
GS uses createWriteStream which is failing

from duplexify.

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.