I\'m using request module in my node.js(express) application. Sometimes this statusCode related error occurs:
TypeError: Cannot read property \'statusCode\'
This is a workaround, as there might be several reasons why response is undefined:
response
undefined
if (!error && response.statusCode == 200) { // do your stuff here.. }