I'm trying to use the @assistant/conversation in restify,
But I get this error:
(node:17) UnhandledPromiseRejectionWarning: Error: Handler not found for handle name:
at Function.handler (/app/node_modules/@assistant/conversation/dist/conversation/conversation.js:109:23)
at Function.standard [as handler] (/app/node_modules/@assistant/conversation/dist/assistant.js:49:32)
at omni (/app/node_modules/@assistant/conversation/dist/assistant.js:41:20)
at nextTick (/app/node_modules/restify/lib/chain.js:167:13)
at process._tickCallback (internal/process/next_tick.js:61:11)
(node:17) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:17) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Example:
// Import the appropriate service and chosen wrappers
const {
conversation,
Image,
Card
} = require('@assistant/conversation');
// Create an app instance
const app = conversation({ });
app.handle('greeting', conv => {
conv.add('Hi, how is it going?')
conv.add(new Image({
url: 'https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/imgs/160204193356-01-cat-500.jpg',
alt: 'A cat',
}));
});
// ... restify code
server.post('/assistant', app);
Hi,
I'm trying to use the @assistant/conversation in restify, But I get this error:
Example:
I use the restify bodyParser
server.use(restify.plugins.bodyParser({ maxBodySize: 1000000 }));
Look like some JSON parser problem. JSON parse on body by restify:
console.log(`HANDLER NAME: ${req.body.handler.name}`);
HANDLER NAME: greetingWithout '@assistant/conversation' works fine: Example: