Node.js Dialogflow/Google Actions fulfillment(使用Google App Engine&;Storage)返回错误4:尽管很简单,但已超过截止日期

Node.js Dialogflow/Google Actions fulfillment(使用Google App Engine&;Storage)返回错误4:尽管很简单,但已超过截止日期,node.js,google-app-engine,google-cloud-storage,actions-on-google,dialogflow-es-fulfillment,Node.js,Google App Engine,Google Cloud Storage,Actions On Google,Dialogflow Es Fulfillment,假设我想创建一个简单的操作,为用户提供一个来自代码列表(在.csv文件中的字符串)的随机代码。我目前设置的是一个Dialogflow代理,它在Google App Engine上运行,我使用Google Storage存储了“code.csv”文件 我成功地读取了文件的代码(我让它记录第一个代码作为检查),但是,当涉及到返回对Dialogflow的响应时,我得到一个“Webhook调用失败。错误:超过了截止日期” 我知道对Dialogflow/Google操作的响应不能超过10秒才能完成,但我从

假设我想创建一个简单的操作,为用户提供一个来自代码列表(在.csv文件中的字符串)的随机代码。我目前设置的是一个Dialogflow代理,它在Google App Engine上运行,我使用Google Storage存储了“code.csv”文件

我成功地读取了文件的代码(我让它记录第一个代码作为检查),但是,当涉及到返回对Dialogflow的响应时,我得到一个“Webhook调用失败。错误:超过了截止日期”

我知道对Dialogflow/Google操作的响应不能超过10秒才能完成,但我从日志中收集到的信息是,它在3秒内读取了相对较小的codes.csv。我不明白是什么原因造成这次抢劫

在Google App Engine上运行的代码:

const express = require('express');
const bodyParser = require('body-parser');
const csv = require('csv-parser');

const { WebhookClient } = require('dialogflow-fulfillment');
const {dialogflow} = require('actions-on-google');
const app = dialogflow({debug: true});

const {Storage} = require('@google-cloud/storage');
const storage = new Storage();
const bucket = storage.bucket('<bucket name>');
const file = bucket.file('codes.csv');

let codes = [];

file.createReadStream()
    .pipe(csv())
    .on('error', function(err) {
        console.log('woops');
    })
    .on('data', function(response) {
        codes.push(response);
    })
    .on('end', function() {
        console.log('read csv');
        console.log(codes[0]['code']); // checks whether 'codes' actually contains the codes
    });

function randomCode() {
    return codes[Math.floor(Math.random()*codes.length)]['code'];
}

app.intent('Default Welcome Intent', (conv) => {
    console.log(codes[1]['code']);
    conv.ask('Hey, here is your random code: ' + randomCode());
    console.log(codes[2]['code']);
});  // neither of the two console.log are reached here

const expressApp = express().use(bodyParser.json());
expressApp.post('/', app);
expressApp.listen(4444);
const express=require('express');
const bodyParser=require('body-parser');
const csv=require('csv-parser');
const{WebhookClient}=require('dialogflow-fulfillment');
const{dialogflow}=require('actions-on-google');
const-app=dialogflow({debug:true});
const{Storage}=require('@googlecloud/Storage');
常量存储=新存储();
const bucket=storage.bucket(“”);
const file=bucket.file('code.csv');
设代码=[];
createReadStream()文件
.pipe(csv())
.on('error',函数(err){
console.log('woops');
})
.on('数据',功能(响应){
代码。推送(响应);
})
.on('end',function(){
log('read csv');
console.log(代码[0]['code']);//检查“code”是否实际包含这些代码
});
函数随机码(){
返回代码[Math.floor(Math.random()*codes.length)]['code'];
}
app.intent('默认欢迎意向',(conv)=>{
log(代码[1]['code']);
conv.ask('嘿,这是你的随机代码:'+randomCode());
log(代码[2]['code']);
});  // 此处未访问到这两个console.log
const expressApp=express().use(bodyParser.json());
expressApp.post(“/”,app);
expressApp.listen(4444);

让我的应用程序侦听端口
4444
,但应用程序引擎需要侦听端口
8080

我假设此代码正在应用程序引擎中运行。那么,应用程序正在端口
4444
中运行?我这样问是因为应用程序引擎希望应用程序监听端口
8080
。此外,这似乎有点令人困惑,你能添加更多细节或编辑问题以使其更清楚吗?@YeriPelona,我不知道应用程序引擎需要应用程序在端口8080上监听,woops