You have a Google Cloud Function set to trigger on a Pub/Sub topic message. What is the expected behavior when a new message is published to that topic?
Think about how event-driven systems respond to each event.
Cloud Functions triggered by Pub/Sub run once for each message published to the topic. Each message is an event that causes the function to execute.
You want to run a Cloud Function whenever a new file is uploaded to a Cloud Storage bucket. Which trigger should you configure?
Consider which event corresponds to file uploads in Cloud Storage.
The 'finalize' event in Cloud Storage triggers when a new object is created or overwritten, which matches file uploads.
You have a Cloud Function triggered by Pub/Sub messages. How can you ensure only authorized publishers can trigger the function?
Think about controlling who can send messages to the event source.
By restricting who can publish to the Pub/Sub topic via IAM, you control who can trigger the function. This is the recommended security practice.
You deploy a Cloud Function triggered by Cloud Storage events. If the function fails, what is the default retry behavior?
Consider how event delivery guarantees work in Cloud Functions.
Cloud Functions triggered by Cloud Storage events automatically retry on failure until the event expires or the function succeeds.
You notice your event-triggered Cloud Function has high cold start latency. Which approach best reduces cold start delays?
Think about what affects how fast a function starts.
Smaller code and fewer dependencies reduce the time needed to load and start the function, lowering cold start latency.