我有一个使用 Actions Builder 构建的应用程序,其中 webhook 处理程序托管在 firebase 端。由于已从旧捆绑包 AOG + Dialogflow 迁移应用程序,因此通过以下方式公开了履行 webhook:
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);
本地版本和已发布的生产版本一切正常,但是,当 Google 团队尝试访问 webhook 端点时,它会引发 500 错误并显示消息:找不到句柄名称的处理程序。错误的完整跟踪是:
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
第29行是awaitfulfillment,上面已经声明过,所以没有多大意义。有没有其他人也遇到过同样的错误,如何解决?任何帮助表示赞赏。