Testing the Function

 

  1. In the Cloud Functions Overview page, beside the last deployed column, you may find 3 dots which display menu for your function. In that, click Test function.
  2. Now, a Function details page will open. In the Triggering event box, add 
     
{"message":"Hello World!"}
  1. . In this testing form, we provide a JSON formatted message. Next, click Test the function. This invokes our function and the output of out function will be shown to us in the output box, and you can see that your function is executed. 
    Output: 
     
Hello World!
  1. Below the Output box, in the Logs field, you might see finished with status code:200. A status code of 200 indicates that your function was successfully executed.

 

 

Deploy cloud function on Google Cloud Platform

Similar Reads

Cloud functions

Google Cloud Function is a serverless execution environment for building and connecting cloud services. By serverless, one means that the cloud functions remove a load of managing servers, configuring or updating software, and patching OSs. The software and infrastructure are completely managed by Google. You just have to add the code....

How they work?

Cloud service (Stackdriver, Cloud Datastore, etc. ) emits required events( Direct HTTP Invocation, etc.), a cloud function responds to those events by invoking other services such as APIs. After invoking other services, the cloud function writes back to cloud services....

Creating a Function

Creating a function is very easy. Here, we will be creating a function using cloud console....

Deploying the Function

Once you click on Create, you are directed to Cloud Functions Overview page, wherein, you can see all the functions created by you, their region, trigger, memory allocated, executed function, and date and time of last deployment....

Testing the Function

...

View logs

You can view the logs from the display menu on Cloud Functions Overview page. Go back to the Cloud Functions Overview page, find the three dots, click on View logs. The log page will look as follows:...