Bird
0
0

What happens if a Cloud Function triggered by Pub/Sub throws an error during execution?

medium📝 service behavior Q5 of 15
GCP - Cloud Pub/Sub

What happens if a Cloud Function triggered by Pub/Sub throws an error during execution?

AThe message is sent to a dead-letter queue automatically.
BThe message is discarded immediately without retry.
CThe message is retried until the function succeeds or the message expires.
DThe function stops and no retry occurs.
Step-by-Step Solution
Solution:
  1. Step 1: Understand Pub/Sub retry behavior

    If a Cloud Function fails, Pub/Sub retries delivering the message until success or expiration.
  2. Step 2: Clarify dead-letter queue behavior

    Dead-letter queues require explicit configuration; they are not automatic.
  3. Final Answer:

    Messages are retried until success or expiration. -> Option C
  4. Quick Check:

    Failed function = message retry [OK]
Quick Trick: Errors cause Pub/Sub to retry message delivery [OK]
Common Mistakes:
  • Assuming no retry on error
  • Believing dead-letter queue is automatic
  • Thinking message is discarded immediately

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GCP Quizzes