Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Application Integrations - Cloud Function task

I have a questions:

1) how to pass request body from CloudFunction's task to cloud function?

2) how to get a response?

I created a function that takes parameters from 'req.body'.

I have tested the functionality of the created function with Postman. The Postman query looks like this

 

 

curl --location 'https://projectName.cloudfunctions.net/functionName' \.
--header 'Content-Type: application/json' \.
--data '{
}, "param1": { "text",
"param2": "text",
"param3": "text"
}'

 

 

CloudFunction source looks like this:

 

 

functions.http('trigger', (req, res) => {
   res.send(businessLogicMethod(req.body.param1, req.body.param2, req.body.param3);
});

 

 

 

0 1 344
1 REPLY 1

Hello @efvcbjdcsdf,

Try the following options:

  1. Check HTTP Request Body. It contains a code example. You must also first authenticate to Cloud Functions by setting up authentication for a local development environment
  2. Take a look at this Stack Overflow Post as it might give insight to your questions.
  3. You can contact Google Cloud Support to further look into your case.

Let me know if it helped, thanks!

Top Labels in this Space