Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/387.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在使用无服务器体系结构时,如何使用Dialogflow实现库?_Javascript_Node.js_Express_Serverless_Dialogflow Es Fulfillment - Fatal编程技术网

Javascript 在使用无服务器体系结构时,如何使用Dialogflow实现库?

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

我正在使用serverless设置一个lambda函数,该函数将通过Google的NLP Dialogflow中的Webhook调用。我的最终目标是能够使用dialogflow实现库

我已尝试通过对所有必需的模块执行“npm安装…”来重新安装node_模块。package.json具有所需的所有依赖项。。使用
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实现库

我想知道为什么它说无法导入模块
应用程序

我对如何重组我的设置持开放态度,到目前为止,我还没有找到一个好的方法