Skip to content


Subversion checkout URL

You can clone with
Download ZIP


pass `null` as the second argument to request, and an object as the first argument, it will fail #205

jmarca opened this Issue · 1 comment

2 participants


I've been doing something wrong that used to work and now fails. possible bug, most likely a programming mistake on my part, but perhaps the docs should make a note so as to prevent this in the future.

If you pass null as the second argument to request, and an object as the first argument, it will fail. For example:

var cuser =  process.env.COUCHDB_USER ;
var cpass =  process.env.COUCHDB_PASS ;
var chost =  process.env.COUCHDB_HOST ;
var cport =  process.env.COUCHDB_PORT || 5984;

var options={'headers':{}
             ,'uri': ''
options.headers.authorization = "Basic " + new Buffer(cuser + ":" + cpass).toString('base64');
var r = request(options,null);

That will fail.

I am piping the output t from couchdb, so I don't really need the callback function. I've been passing null, but I noticed today that with request@2.9.153 that breaks with the error:

        throw e; // process.nextTick error, or 'error' event on first tick
TypeError: Cannot set property 'uri' of null
    at request (/home/james/node_modules/request/main.js:793:17)
    at Object.<anonymous> (/home/james/requestfail.js:15:9)

Passing nothing as the second argument works fine:

var r = request(options);

Is this still an issue?

This is so old I'm closing, if it is actually still an issue just let me know and I'll re-open.

@mikeal mikeal closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.