Firebase: can I "not recognize" a PubSub message inside a Firebase cloud function?
I have a Firebase cloud function that is triggered by a PubSub post. The function must either consume the message or wait to use it later.
Is there a way to return from this function without acknowledging the message so that it can be re-delivered at a later time?
For example, can I return Message
from a cloud function? The docs seems to indicate that this is possible if I read them correctly:
Refunds
non-null functions.CloudFunction containing non-null functions.pubsub.Message A Cloud Function which you can export.
source to share
When PubSub runs a function (Firebase or Cloud Function), if the function completes correctly, the message is confirmed. But if the function crashes or throws an exception (resulting in abnormal termination), the message is not acknowledged and re-sent immediately .
This repetition cycle is performed until the message is acknowledged or the message expires (by default and the maximum TTL is 7 days, the minimum is 10 minutes. You can adjust the RetentionDuration message in the subscription).
source to share