2
votes

The official documentation does mention that Google Cloud Pub / Sub resends messages to subscribers until subscribers acknowledge the message receipt when using official Cloud Pub / Sub Node.js client.

But it does not explicitly mention this for background functions if they return a callback error. Refer https://cloud.google.com/functions/docs/writing/background.

If it helps - My background function does not use the official Cloud Pub / Sub Node.js client since I get all the required info from the event arguement itself.

1
So your subscriber using is using push pubsub, right? Is your code trapping the error and generating an http error response?Oliver
It's a Background Function which can be called as push. I do send an error with the callback.Raj Chaudhary

1 Answers

-1
votes

From documentation: https://cloud.google.com/functions/docs/bestpractices/retries

Cloud Functions guarantees at-least-once execution of a background function for each event emitted by an event source. However, by default, if a function invocation terminates with an error, the function will not be invoked again, and the event will be dropped. When you enable retries on a background function, Cloud Functions will retry a failed function invocation until it completes successfully, or the retry window expires.

And described below, you can enable retry on errors:

In any of the above cases, the function stops executing by default and the event is discarded. If you want to retry the function when an error occurs, you can change the default retry policy by setting the "retry on failure" property. This causes the event to be retried repeatedly for up to multiple days until the function successfully completes.