[英]Host Actions On Google App With Dialogflow Using Node JS on Self Hosted HTTPS Server (MalformedResponse: Webhook error (206))
I have created one app in actions on google with dialogflow using nodejs. 我使用nodejs在google上使用dialogflow创建了一个应用程序。 First it is hosted on heroku server, but now i want to host in my server with https.
首先它托管在heroku服务器上,但现在我想用https在我的服务器上托管。
it works properly on heroku server but not working on my server. 它在heroku服务器上正常工作但不能在我的服务器上运行。 It returns error "MalformedResponse: Webhook error (206)"
它返回错误“MalformedResponse:Webhook error(206)”
const express = require('express');
const bodyParser = require('body-parser');
var https = require('https');
var fs = require('fs');
const {
dialogflow,
} = require('actions-on-google');
const app = dialogflow();
const expressApp = express().use(bodyParser.json());
// degault welcome intent on startup
app.intent('Default Welcome Intent', conv => {
conv.ask('Hi, Ask me about Customer Ledger, Outstanding....');
});
app.intent('Default Fallback Intent', conv => {
conv.ask('I didnt understand. Can you tell me something else?');
});
var options = {
key: fs.readFileSync('ssl/office.key'),
cert: fs.readFileSync('ssl/office.crt')
};
var server = https.createServer(options, expressApp).listen(3000, function(){
//express().use(bodyParser.json(), app);
expressApp.post('/fulfillment', app);
console.log("Express server listening on port 3000" );
});
Can anyone suggest me what is the problem with my code? 谁能告诉我我的代码有什么问题? Simulator Screenshot
模拟器截图
如果您正在使用express并且中间没有其他层(如Heroku所有)将请求从端口443转发到3000,则请求可能无法到达目标端口
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.