Mav*_*ck7 5 google-cloud-datastore google-cloud-platform gcloud
我是 Gcloud 的第一次用户。当我运行以下命令时:
gcloud beta functions deploy FirstBot --stage-bucket [BUCKET_NAME] --trigger-http
Run Code Online (Sandbox Code Playgroud)
我在 cmd 中收到此错误:
ERROR: (gcloud.beta.functions.deploy) OperationError: code=3, message=Function l
oad error: File index.js or function.js that is expected to define function does
n't exist in the root directory.
Run Code Online (Sandbox Code Playgroud)
我尝试了 2 个 index.js 文件:这是第 1 个:
/*
HTTP Cloud Function.
@param {Object} req Cloud Function request context.
@param {Object} res Cloud Function response context.
*/
exports.FirstBot = function FirstBot (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)
这是第二个:
/
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)
我的项目名称是FirstBot。我也创建了一个桶。
我的 FirstBot 文件夹的路径是 C:\FirstBot。index.js 文件位于其中。我正在关注以下教程:https ://api.ai/docs/getting-started/basic-fulfillment-conversation
请帮忙..将不胜感激!
| 归档时间: |
|
| 查看次数: |
5595 次 |
| 最近记录: |