google cloud datastore - gCloud: File index.js does not exist in root directory -
i first time user of gcloud. when run following command:
gcloud beta functions deploy firstbot --stage-bucket [bucket_name] --trigger-http
i'm getting error in cmd:
error: (gcloud.beta.functions.deploy) operationerror: code=3, message=function l oad error: file index.js or function.js expected define function n't exist in root directory.
i have tried 2 index.js files: here's no.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 sample response webhook!" //default response webhook show it's working res.setheader('content-type', 'application/json'); //requires application/json mime type res.send(json.stringify({ "speech": response, "displaytext": response //"speech" spoken version of response, "displaytext" visual version })); };
here's second one:
/ 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 sample response webhook!" //default response webhook show it's working res.setheader('content-type', 'application/json'); //requires application/json mime type res.send(json.stringify({ "speech": response, "displaytext": response //"speech" spoken version of response, "displaytext" visual version })); };
the name of project firstbot. have created bucket also.
the path of firstbot folder c:\firstbot. index.js file inside it. following tutorial at: https://api.ai/docs/getting-started/basic-fulfillment-conversation
kindly help..would grateful!
i solved installing npm javascript.
Comments
Post a Comment