0

I've got an application built with Actions Builder with webhook handlers hosted on the firebase side. As an application has been migrated from old bundle AOG + Dialogflow, fulfillment webhook was exposed in the next way:

    const functions = require('firebase-functions');
    const passport = require('passport');
    const express = require('express'); 
    const bodyParser = require('body-parser');
    const app = express();
    const fulfillment = require('../fulfillment');

    app.use(bodyParser.json());

    app.post('/', 
          async function(request, response) {
          await fulfillment(request, response);
        });

    exports.fulfillment = functions.https.onRequest(app);

Everything is working fine for both local and released production version, however, when Google team tries to reach a webhook endpoint, it throws a 500 error with a message: Handler not found for handle name. Full trace of an error is:

Error: Handler not found for handle name: 
at Function.handler (/workspace/node_modules/@assistant/conversation/dist/conversation/conversation.js:139:23)
at standard (/workspace/node_modules/@assistant/conversation/dist/assistant.js:50:32)
at /workspace/node_modules/@assistant/conversation/dist/framework/express.js:29:13
at omni (/workspace/node_modules/@assistant/conversation/dist/assistant.js:39:53)
at /workspace/src/functions/fulfillment.function.js:29:13
at Layer.handle [as handle_request] (/workspace/node_modules/express/lib/router/layer.js:95:5)
at next (/workspace/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/workspace/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/workspace/node_modules/express/lib/router/layer.js:95:5)
at /workspace/node_modules/express/lib/router/index.js:281:22 

Line 29 is await fulfillment, which is declared above, so it doesn't make a lot of sense. Have anybody else also experienced the same error, and how it can be solved? Any help appreciated.

1 Answers1

0

It's hard to say for sure since you didn't post the contents of fulfillment but it also seems like 'handle name' is not defined. In Actions Builder, you have intents that are technically separate from the expected name that you'll receive in the webhook.

In the screenshot below, you specify "handler_name" as the handler you'll need in the webhook fulfillment.

enter image description here

Nick Felker
  • 11,536
  • 1
  • 21
  • 35
  • So to make it clearer, the content of the fulfillment looks next: `const { conversation, Card, CollectionBrowse, Image, Link, Simple, } = require('@assistant/conversation'); const app = conversation(); app.handle('intent_name', async (conv, params) => { ...... }) module.exports = app;` And yes, in webhook fulfillment I use link to fulfillment function: https://us-central1-project-name.cloudfunctions.net/fulfillment – pavel-zheldak Feb 21 '22 at 18:44
  • please see the comment above – pavel-zheldak Feb 21 '22 at 18:49
  • And is `intent_name` the name of the handler as shown in the posted screenshot? – Nick Felker Feb 21 '22 at 23:33
  • Yes. And the problem is that "fulfillment" name is only used as a name of firebase function as per my previous comment. So there is no place where the intent handler with the name "fulfillment" is expected. – pavel-zheldak Feb 22 '22 at 11:58