I am trying nTwitter (nodejs v0.6.10) - I tried using the example code for searching twitter but I get the following error when trying the search function for the library (the keys I am using appear to be correct):
Cannot set property 'q' of null
Any ideas what might be causing this issue - stack trace is copied below (so is the code)?
//twit is instance of Twitter (with keys assigned in)
twit.search('nodejs', function(err, data) {
if (err) {
console.log('Twitter search failed!');
}
else {
console.log('Search results:');
console.dir(data);
}
});
at Object.merge (/opt/testDir/node/node_modules/ntwitter/lib/utils.js:9:18) at Twitter.search (/opt/testDir/node/node_modules/ntwitter/lib/twitter.js:167:18) at Object.search (/opt/testDir/node/projects/testApp/public/javascripts/nTwitterTest.js:13:6) at nTwitterTestMediator (/opt/testDir/node/projects/testApp/app.js:1188:14) at callbacks (/opt/testDir/node/projects/testApp/node_modules/express/lib/router/index.js:272:11) at param (/opt/testDir/node/projects/testApp/node_modules/express/lib/router/index.js:246:11) at pass (/opt/testDir/node/projects/testApp/node_modules/express/lib/router/index.js:253:5) at Router._dispatch (/opt/testDir/node/projects/testApp/node_modules/express/lib/router/index.js:280:4) at Object.handle (/opt/testDir/node/projects/testApp/node_modules/express/lib/router/index.js:45:10) at next (/opt/testDir/node/projects/testApp/node_modules/connect/lib/http.js:201:15)
Pilot error - the settings on twitter were not updated (from read only to read-write-execute). I switched to read & write (instead of read, write and execute) and the settings changed (this was due to my ignorance of twitter api's & permission levels).
I was able to post tweets as well as access the streaming API (with the code on the github page) with the read-write access level for the twitter app.
I am still unable to use the search feature (code below).
twit.search('nodejs', function(err, data) {
if (err) {
console.log('Twitter search failed!');
}
else {
console.log('Search results:');
console.dir(data);
}
});
Thanks
I had this problem as well. You are missing one parameter.
Try this:
twit.search('nodejs', {}, function(err, data){
I think this was an error in the original ntwitter documentation.
Pilot error - the settings on twitter were not updated (from read only to read-write-execute).
I switched to read & write (instead of read, write and execute) and the settings changed (this was due to my ignorance of twitter api's & permission levels).
I was able to post tweets as well as access the streaming API (with the code on the github page) with the read-write access level for the twitter app.
I am still unable to use the search feature (code below).
twit.search('nodejs', function(err, data) {
if (err) {
console.log('Twitter search failed!');
}
else {
console.log('Search results:');
console.dir(data);
}
});
Thanks.