You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking through open and closed issues, it seems a lot of folks are having problems similar to this. Various methods fail inconsistently with Uncaught TypeError: undefined is not a function. Mostly PUT.
Code to reproduce is here. Failures are inconsistent. I can get it to fail roughly 20% of the time.
SuperAgent
✓ GET all fails inconsistently
✓ POST fails inconsistently
✓ GET fails inconsistently
1) PUT fails inconsistently
✓ DELETE fails inconsistently
4 passing (25ms)
1 failing
1) SuperAgent PUT fails inconsistently:
Uncaught TypeError: undefined is not a function
at Socket.socketErrorListener (_http_client.js:271:9)
at net.js:950:16
The text was updated successfully, but these errors were encountered:
Hey Guys, I am having a similar issue, not only with "PUT" request but also with "GET" requests, I traced it back up to https://github.com/visionmedia/superagent/blob/master/lib/node/index.js#L736. #set and other methods internally calls #request() to create a request to work on. _callback attribute is set on #end, so _callback is not defined at that point. It seems that sometimes node emits an error before #end gets called and so we get this exception.
request.put( url + "/1" )
// request() is called by `set` which creates the http request object and
// attaches `error` event handler, `#_callback` is not defined at this point.
// Sometimes node seems to emit an error at this point, before "end", which
// seems to be causing the problem.
.set( { "Content-Type": "application/json" } )
.send( { foo: "bar" } )
.end( function( err, res ) {
expect( res ).to.equal( "put 1" );
done();
});
Looking through open and closed issues, it seems a lot of folks are having problems similar to this. Various methods fail inconsistently with
Uncaught TypeError: undefined is not a function
. Mostly PUT.Code to reproduce is here. Failures are inconsistent. I can get it to fail roughly 20% of the time.
Mocha reporter output after a failure:
The text was updated successfully, but these errors were encountered: