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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -