[英]DialogFlow Webhook : Error: EROFS: read-only file system, open '.node-xmlhttprequest-sync-2'
I'm creating DialogFlow app and deployed fulfillment with Cloud Functions for Firebase which uses XMLHttpRequest. 我正在创建DialogFlow应用程序,并通过使用XMLHttpRequest的Cloud Functions for Firebase部署了实现。 But following error occurred.
但是发生以下错误。
Error: EROFS: read-only file system, open '.node-xmlhttprequest-sync-2' at Error (native) at Object.fs.openSync (fs.js:642:18) at Object.fs.writeFileSync (fs.js:1348:33) at send (/user_code/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:477:10)
错误:EROFS:只读文件系统,在Object.fs.writeFileSync(fs.fs.openSync(fs.js:642:18),错误(native),在错误(本机)打开'.node-xmlhttprequest-sync-2'。 js:1348:33)发送(/user_code/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:477:10)
My code is something like this. 我的代码是这样的。
'use strict';
const admin = require('firebase-admin');
const functions = require('firebase-functions');
const DialogflowApp = require('actions-on-google').DialogflowApp;
const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
const googleAssistantRequest = 'google';
const Actions = {
UNRECOGNIZED_DEEP_LINK: 'deeplink.unknown',
TEST_HTTPREQUEST: 'test.httprequest'
};
const testHttpRequest = app => {
var req = new XMLHttpRequest();
req.open('GET', 'http://www.google.com', false);
req.send();
if (req.status === 200) {
console.log(req.responseText);
}
}
const actionMap = new Map();
actionMap.set(Actions.TEST_HTTPREQUEST, testHttpRequest);
exports.mytestapp = functions.https.onRequest((request, response) => {
const app = new DialogflowApp({ request, response });
console.log(`Request headers: ${JSON.stringify(request.headers)}`);
console.log(`Request body: ${JSON.stringify(request.body)}`);
app.handleRequest(actionMap);
});
Does anyone have idea on how to solve this error? 有谁知道如何解决这个错误?
Your function testHttpRequest
needs to use app
to respond to the user's request from Dialogflow. 您的函数
testHttpRequest
需要使用app
来响应Dialogflow用户的请求。 Use the ask
or tell
methods to respond to the request. 使用
ask
或tell
方法来响应请求。 For example after the if statement in testHttpRequest
you could add: 例如,在
testHttpRequest
的if语句之后,您可以添加:
app.tell('This response came from Cloud Functions for Firebase!');
which tells the Action on Google client library to send the string as a response to your request when you call your Assistant app from the Action on Google simulator or Google Assistant device (see Action on Google testing docs). 当您从Google模拟器上的Action或Google Assistant设备上调用Assistant应用时,它会告诉Google客户端库上的Action发送字符串作为对您请求的响应(请参阅Google测试文档上的Action)。
You may also be running into a issue with action names. 您可能还会遇到动作名称问题。 The action you refer to in your fulfillment here (
deeplink.unknown
and test.httprequest
) must also be list as an action in an intent in your Dialogflow agent otherwise your code will never be triggered. 您在实现中引用的操作(
deeplink.unknown
和test.httprequest
)也必须作为Dialogflow代理中的意图操作列出,否则将永远不会触发您的代码。 The Google Assistant also requires a welcome intent. Google助手还需要一个欢迎的意图。 By default the welcome intent in Dialogflow has an action of
input.welcome
which is not included in your code so you code may not be trigger until you match the actions listed in your code and in your Dialogflow agent. 默认情况下,在Dialogflow欢迎有意向的动作
input.welcome
这是不是在你的代码中包含了,直到你匹配你的代码,并在您Dialogflow剂中的动作,你的代码可能无法触发。
Furthermore external HTTP calls (outside the Google's network) are not permitted on Cloud Functions without setting up billing first . 此外, 在未先设置结算功能的情况下,不允许在Cloud Functions上进行外部HTTP调用(在Google网络外部)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.