wit-ai / node-wit

Node.js SDK for Wit.ai
Other
2.04k stars 485 forks source link

CB is not a function #30

Closed dfischer closed 8 years ago

dfischer commented 8 years ago
        const context = {};
        client.message('what is the weather in London?', context, (error, data) => {
            if (error) {
                console.log('Oops! Got an error: ' + error);
            } else {
                console.log('Yay, got Wit.ai response: ' + JSON.stringify(data));
            }
        });

Produces:

/Users/daniel/Code/opensource/botkit-middleware-witai/node_modules/node-wit/lib/wit.js:32
        cb(null, data);
        ^

TypeError: cb is not a function
    at /Users/daniel/Code/opensource/botkit-middleware-witai/node_modules/node-wit/lib/wit.js:32:9
    at doNTCallback0 (node.js:417:9)
    at process._tickCallback (node.js:346:13)
[nodemon] app crashed - waiting for file changes before starting...

All the other methods work fine. Odd?

dfischer commented 8 years ago

Figured it out, it's not supposed to have context.

patapizza commented 8 years ago

If you clone the repository, you won't have this issue: message() does take context now. There is a mismatch between the documentation and the code released. I'll fix that tomorrow.

dfischer commented 8 years ago

Ah got it, cool. Will check in tomorrow.