gcloud 部署函数错误代码 3
gcloud deploy function error code 3
我正在学习 api.ai tutorial 的基本实现和对话设置教程,以便为 facebook Messenger 创建一个机器人,当我尝试使用以下命令部署该功能时:
gcloud beta functions deploy testBot --stage-bucket testbot-e9bc4.appspot.com --trigger-http
(其中 'testBot' 是项目名称,'testbot-e9bc4.appspot.com' 是 bucket_name,我认为..)
它 return 以下错误消息:
ERROR: (gcloud.beta.functions.deploy) OperationError: code=3, message=Source code size exceeds the limit
我已经搜索过了,没有找到任何答案,我不知道错误在哪里。
这是教程中出现的 JS 文件:
/
HTTP Cloud Function.
@param {Object} req Cloud Function request context.
@param {Object} res Cloud Function response context.
*/
exports.helloHttp = function helloHttp (req, res) {
response = "This is a sample response from your webhook!" //Default response from the webhook to show it's working
res.setHeader('Content-Type', 'application/json'); //Requires application/json MIME type
res.send(JSON.stringify({ "speech": response, "displayText": response
//"speech" is the spoken version of the response, "displayText" is the visual version
}));
};
在创建 index.js 的位置打开命令提示符并 运行 上面的 gcloud 命令。
在执行 gcloud beta functions deploy testBot --stage-bucket testbot-e9bc4.appspot.com --trigger-http
命令之前,请确保您位于 go 代码所在的正确目录中。
我在快递项目工作。就我而言,我错误地在 devDependencies 而不是依赖项中安装了 @google/storage 包。当我使用 mocha 在调试模式下测试项目时,我无法注意到。所以在调试中,它能够在 devDependencies 中找到该包,但在部署函数中,它试图在 package.json 中的依赖项中找到但无法在那里找到。
我正在学习 api.ai tutorial 的基本实现和对话设置教程,以便为 facebook Messenger 创建一个机器人,当我尝试使用以下命令部署该功能时:
gcloud beta functions deploy testBot --stage-bucket testbot-e9bc4.appspot.com --trigger-http
(其中 'testBot' 是项目名称,'testbot-e9bc4.appspot.com' 是 bucket_name,我认为..) 它 return 以下错误消息:
ERROR: (gcloud.beta.functions.deploy) OperationError: code=3, message=Source code size exceeds the limit
我已经搜索过了,没有找到任何答案,我不知道错误在哪里。 这是教程中出现的 JS 文件:
/
HTTP Cloud Function.
@param {Object} req Cloud Function request context.
@param {Object} res Cloud Function response context.
*/
exports.helloHttp = function helloHttp (req, res) {
response = "This is a sample response from your webhook!" //Default response from the webhook to show it's working
res.setHeader('Content-Type', 'application/json'); //Requires application/json MIME type
res.send(JSON.stringify({ "speech": response, "displayText": response
//"speech" is the spoken version of the response, "displayText" is the visual version
}));
};
在创建 index.js 的位置打开命令提示符并 运行 上面的 gcloud 命令。
在执行 gcloud beta functions deploy testBot --stage-bucket testbot-e9bc4.appspot.com --trigger-http
命令之前,请确保您位于 go 代码所在的正确目录中。
我在快递项目工作。就我而言,我错误地在 devDependencies 而不是依赖项中安装了 @google/storage 包。当我使用 mocha 在调试模式下测试项目时,我无法注意到。所以在调试中,它能够在 devDependencies 中找到该包,但在部署函数中,它试图在 package.json 中的依赖项中找到但无法在那里找到。