Javascript 在使用无服务器体系结构时,如何使用Dialogflow实现库?
我正在使用serverless设置一个lambda函数,该函数将通过Google的NLP Dialogflow中的Webhook调用。我的最终目标是能够使用dialogflow实现库 我已尝试通过对所有必需的模块执行“npm安装…”来重新安装node_模块。package.json具有所需的所有依赖项。。使用Javascript 在使用无服务器体系结构时,如何使用Dialogflow实现库?,javascript,node.js,express,serverless,dialogflow-es-fulfillment,Javascript,Node.js,Express,Serverless,Dialogflow Es Fulfillment,我正在使用serverless设置一个lambda函数,该函数将通过Google的NLP Dialogflow中的Webhook调用。我的最终目标是能够使用dialogflow实现库 我已尝试通过对所有必需的模块执行“npm安装…”来重新安装node_模块。package.json具有所需的所有依赖项。。使用npm init // handler.js const debug = require('debug')('http'); const express = require('expres
npm init
// handler.js
const debug = require('debug')('http');
const express = require('express')
const sls = require('serverless-http');
const app = express();
app.get('/', async (req, res, next) => {
//console.log(req + res);
const { WebhookClient } = require('dialogflow-fulfillment')
const agent = new WebhookClient({ req, res });
function justSayHi(agent) {
console.log(`Something's happening`);
agent.add('Hello from dialogflow-fulfillment');
}
let intentMap = new Map();
intentMap.set('justsayhi', justSayHi);
agent.handleRequest(intentMap);
console.log("webhook called")
});
module.exports.server = sls(app);
在命令提示符下打印日志时,我收到以下错误消息:
"Unable to import module 'app': Error
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)"
同样,我的最终目标是能够利用无服务器架构使用Dialogflow实现库
我想知道为什么它说无法导入模块应用程序
我对如何重组我的设置持开放态度,到目前为止,我还没有找到一个好的方法