bnoguchi/everyauth — Issue #150: Cannot read property '1' of null
Author: exos
Created: 2012-01-07 05:49:57+00:00
State: open

Error login with twitter crash the application:

^Cexos@hexdev-back:~/alpha/pregcopy/src$ node app.js
Express server listening on port 3000 in development mode
starting step - getRequestToken

/home/exos/alpha/pregcopy/src/node_modules/everyauth/lib/modules/twitter.js:35
return new Error(data.data.match(/(.+)<\/error>/)[1]);
^
TypeError: Cannot read property '1' of null
at /home/exos/alpha/pregcopy/src/node_modules/everyauth/lib/modules/twitter.js:35:61
at /home/exos/alpha/pregcopy/src/node_modules/everyauth/lib/step.js:98:21
at [object Object].fail (/home/exos/alpha/pregcopy/src/node_modules/everyauth/lib/promise.js:53:24)
at /home/exos/alpha/pregcopy/src/node_modules/everyauth/lib/modules/oauth.js:105:18
at /home/exos/alpha/pregcopy/src/node_modules/everyauth/node_modules/oauth/lib/oauth.js:510:17
at passBackControl (/home/exos/alpha/pregcopy/src/node_modules/everyauth/node_modules/oauth/lib/oauth.js:366:13)
at IncomingMessage. (/home/exos/alpha/pregcopy/src/node_modules/everyauth/node_modules/oauth/lib/oauth.js:378:9)
at IncomingMessage.emit (events.js:88:20)
at HTTPParser.onMessageComplete (http.js:137:23)
at CleartextStream.ondata (http.js:1124:24)
exos@hexdev-back:~/alpha/pregcopy/src$ node app.js
Express server listening on port 3000 in development mode
starting step - getRequestToken

I edited the file everyauth/lib/modules/twitter.js and change:

.convertErr( function (data) {

console.log(data);

return new Error(data.data.match(/(.+)<\/error>/)[1]);
});

By:

.convertErr( function (data) {

console.log(data);

return new Error(data.data);
});

I supuse this work (trow the error by stdout and crash):

exos@hexdev-back:~/alpha/pregcopy/src$ node app.js
Express server listening on port 3000 in development mode

starting step - getRequestToken

/home/exos/alpha/pregcopy/src/node_modules/everyauth/lib/modules/everymodule.js:352
throw err;
^
Error: Failed to validate oauth signature and token
at /home/exos/alpha/pregcopy/src/node_modules/everyauth/lib/modules/twitter.js:38:12
at /home/exos/alpha/pregcopy/src/node_modules/everyauth/lib/step.js:98:21
at [object Object].fail (/home/exos/alpha/pregcopy/src/node_modules/everyauth/lib/promise.js:53:24)
at /home/exos/alpha/pregcopy/src/node_modules/everyauth/lib/modules/oauth.js:105:18
at /home/exos/alpha/pregcopy/src/node_modules/everyauth/node_modules/oauth/lib/oauth.js:510:17
at passBackControl (/home/exos/alpha/pregcopy/src/node_modules/everyauth/node_modules/oauth/lib/oauth.js:366:13)
at IncomingMessage. (/home/exos/alpha/pregcopy/src/node_modules/everyauth/node_modules/oauth/lib/oauth.js:378:9)
at IncomingMessage.emit (events.js:88:20)
at HTTPParser.onMessageComplete (http.js:137:23)
at CleartextStream.ondata (http.js:1124:24)