Reputation: 33
I have a google cloud function triggered by PubSub, and I'm trying to forward an execution with error to a dead letter topic.
I am forcing an error:
throw Error('test')
And the function is finished with status error. Ending a function with an error, should the message be forwarded to the Dead Letter topic?
Upvotes: 2
Views: 313
Reputation: 75775
When you bind your Cloud Function with PubSub directly, I mean, you use the --trigger-topic option when you deploy, some PubSub feature aren't available. It's the case for the Dead Letter topic, for the filtering and for the ordering key for example .
If you want to use these features, you need to deploy your function as HTTP function and to call it with a PubSub push subscription that you can customize as you which.
Be careful, the format of PubSub message in a HTTP push function isn't exactly the same as background function. The function signature also change a bit. You need to rework a few on your code before achieving the change.
Upvotes: 2