assaf/node-replay

TypeError on Node.js 6.2.2

spect88 opened this issue · 4 comments

It's happened in 2 projects when I tried to update to Node.js 6.2.2.
6.2.0 was fine.

TypeError: Cannot set property 'readingMore' of undefined
    at ProxyRequest.IncomingMessage (_http_incoming.js:28:35)
    at new ProxyRequest (/Users/spect/git/refme-dashboard/node_modules/replay/lib/replay/proxy.js:27:26)
    at Object.HTTPS.request (/Users/spect/git/refme-dashboard/node_modules/replay/lib/replay/index.js:69:13)
    at Request.request (/Users/spect/git/refme-dashboard/node_modules/superagent/lib/node/index.js:528:28)

I got the same issue with Node 6.3.0 however my coworker is on Node 6.2.1 and he doesn't have it.

This issue seems to have been introduced by this change in nodejs: nodejs/node@ad1045c. I was able to fix it locally by adding this._readableState = {} to proxy.js:27 (compiled) in the code for this project. It's not obvious to me what's actually breaking it, or what the right fix is though.

Same problem with node 4.5.0. Below the snippet of code:

const Replay = require("replay"),
      request = require("request");

describe("test", () => {
    before(() => {
        Replay.fixtures = __dirname;
    });

    it("request", (done) => {
        request("http://www.fi.uba.ar", (err, res, body) => {
            done(err);
        });
    });
});

Fix released as 2.1.1. Thank you.