私は初めてGcloudのユーザーです。gCloud:ファイルindex.jsがルートディレクトリに存在しません
gcloud beta functions deploy FirstBot --stage-bucket [BUCKET_NAME] --trigger-http
私はCMDでこのエラーを取得しています:私は2つのindex.jsファイル試してみました
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.
:私は、次のコマンドを実行すると
/*
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
}));
};
: をここで1番です
ここでは二番目だ:
/
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
}));
};
私のプロジェクトの名前はFirstBotです。 バケットも作成しました。
私のFirstBotフォルダのパスはC:\ FirstBotです。 index.jsファイルはその内部にあります。 私は次のチュートリアルに従っています:https://api.ai/docs/getting-started/basic-fulfillment-conversation
親切に助けてくれてありがとう!
調査が続行されるため、質問の内容を完全に変更する必要はありません。すべてを無効にします。新しい質問をして、元の質問を最終的に文脈として参照します。 –
この問題を解決できましたか?もしそうならコミュニティをより良くするための答えとしてあなたの答えを投稿することをお勧めします。それでも問題が解決しない場合は、最新のGCloudをインストールし、[デプロイメントガイド](https://cloud.google.com/functions/docs/deploying/filesystem)に従うために 'gcloud components update'を実行することをお勧めします。 – Jordan