0
0
GCPcloud~10 mins

Function deployment and testing in GCP - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to deploy a Cloud Function named 'helloWorld'.

GCP
gcloud functions deploy helloWorld --runtime [1] --trigger-http --allow-unauthenticated
Drag options to blanks, or click blank then click option'
Ago113
Bnodejs16
Cpython39
Druby27
Attempts:
3 left
💡 Hint
Common Mistakes
Using an unsupported runtime version.
Misspelling the runtime name.
2fill in blank
medium

Complete the code to test the deployed Cloud Function using curl.

GCP
curl -X GET [1]
Drag options to blanks, or click blank then click option'
Ahttps://storage.googleapis.com/helloWorld
Bhttps://cloudfunctions.googleapis.com/v1/helloWorld
Chttps://console.cloud.google.com/functions/details/helloWorld
Dhttps://region-project.cloudfunctions.net/helloWorld
Attempts:
3 left
💡 Hint
Common Mistakes
Using the Cloud Console URL instead of the function trigger URL.
Using a storage or API URL unrelated to the function trigger.
3fill in blank
hard

Fix the error in the deployment command by completing the missing flag.

GCP
gcloud functions deploy helloWorld [1] main --runtime python39 --trigger-http
Drag options to blanks, or click blank then click option'
A--entry-point
B--region
C--timeout
D--memory
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing entry point with memory or timeout flags.
Omitting the entry point when the function name is not default.
4fill in blank
hard

Fill both blanks to set environment variables during deployment.

GCP
gcloud functions deploy helloWorld --runtime python39 --trigger-http --set-env-vars [1]=[2]
Drag options to blanks, or click blank then click option'
AENVIRONMENT
Bproduction
CDEBUG
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping variable name and value.
Using invalid environment variable names.
5fill in blank
hard

Fill all three blanks to write a test command that sends JSON data to the function.

GCP
curl -X POST -H 'Content-Type: application/json' -d '{"name": "[1]"}' [2] [3]
Drag options to blanks, or click blank then click option'
AAlice
Bhttps://region-project.cloudfunctions.net/helloWorld
C--silent
DBob
Attempts:
3 left
💡 Hint
Common Mistakes
Using an incorrect URL.
Omitting the content type header.
Not formatting JSON data properly.