5. You want to build a serverless app that processes images uploaded to Cloud Storage and stores metadata in Firestore. Which serverless pattern best fits this use case?
hard
A. Using a scheduled job to scan the bucket every hour
B. Manual invocation of functions via HTTP requests
C. Running a VM continuously to watch the bucket
D. Event-driven functions triggered by Cloud Storage events
Solution
Step 1: Analyze use case requirements
The app needs to react immediately to image uploads and process them.
Step 2: Match pattern to requirement
Event-driven functions triggered by Cloud Storage events run code automatically on uploads.
Step 3: Evaluate other options
Manual HTTP triggers, VMs, or scheduled jobs are less efficient or not real-time.
Final Answer:
Event-driven functions triggered by Cloud Storage events -> Option D