cyb*_*don 5 google-cloud-storage google-cloud-platform gcloud google-cloud-functions
我正在做api.ai教程的基本实现和会话设置教程,以创建聊天机器人,当我尝试使用以下命令部署该功能时:
gcloud beta functions deploy --stage-bucket venky-bb7c4.appspot.com --trigger-http
Run Code Online (Sandbox Code Playgroud)
(其中“ venky-bb7c4.appspot.com”是bucket_name),它返回以下错误消息:
ERROR: (gcloud.beta.functions.deploy) OperationError: code=3, message=Source code size exceeds the limit
Run Code Online (Sandbox Code Playgroud)
我已经搜索过但没有找到任何答案,我不知道错误在哪里。这是本教程中显示的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
}));
};
Run Code Online (Sandbox Code Playgroud)
小智 4
该命令使用整个命令创建 zip而不仅仅是 JS 文件(这是因为您的函数可能使用其他资源)。
您看到的错误是因为目录中(未压缩)文件的大小大于 512MB。
解决此问题的最简单方法是将 .js 文件移动到其自己的目录并从那里进行部署(--local-path
如果您希望工作目录与包含函数源的目录不同,可以使用 指向包含源文件的目录)。
归档时间: |
|
查看次数: |
2011 次 |
最近记录: |