criso / fbgraph

NodeJs module to access the facebook graph api
http://criso.github.io/fbgraph/
1.09k stars 176 forks source link

Bug when I try to use graph.fql #42

Closed damienfa closed 10 years ago

damienfa commented 10 years ago

When I try :

var graph = require('fbgraph');
var fqlRequester = graph.fql;
fqlRequester('SELECT [...]', function(err,rep) {
console.log(rep);
});

I get :

TypeError: Object #<Object> has no method 'get'
    at exports.fql (./node_modules/fbgraph/lib/graph.js:340:15)

It's true, it cannot work ! Isn't it ? On line 340, if i replace "this.get" by "exports.get(", it works like a charm.

Does I make a bad usage of the lib ?

Thanks !

criso commented 10 years ago

There's something wrong in your setup. I just tried: % npm install fbgraph % node

var graph = require('fbgraph') graph.fql("SELECT about FROM page WHERE name ='redbull'", function (err, resp) { console.log(err, resp)})

And the call went through

damienfa commented 10 years ago

Sorry, I edited my issue. It only happens when you dedicate the function "graph.fql" to another var. Example : var fqlRequest = graph.fql; fqlRequest("SELECT about FROM page WHERE name ='redbull'", function (err, resp) { console.log(err, resp)})

Thanks,

Damien

On Thu, Jan 30, 2014 at 4:58 PM, Cristiano Oliveira < notifications@github.com> wrote:

There's something wrong in your setup. I just tried: % npm install fbgraph % node

var graph = require('fbgraph') graph.fql("SELECT about FROM page WHERE name ='redbull'", function (err, resp) { console.log(err, resp)})

And the call went through

Reply to this email directly or view it on GitHubhttps://github.com/criso/fbgraph/issues/42#issuecomment-33701192 .

criso commented 10 years ago

Yeah, you shouldn't do that. You're losing scope.