Hi, I’ve been playing around with async events and I’m testing the behavior of throw new InvocationError(...)
. However, I’m receiving a FUNCTION_ERR
in my logs and the consumer isn’t called again.
Context: I’m using Forge with UI Kit 2. I have a small frontend modal which is calling a function. That function is pushing a message to the queue. A consumer function is processing this message. This connection working fine. It just stops working when I want to retry the message in my consumer.
This is what I do in my consumer function:
const resolver = new Resolver();
resolver.define("event-listener", async ({payload}) => {
// processing payload... (skipped)
// in case of error I throw the following:
throw new InvocationError({
retryAfter: 123,
retryData: { ... },
retryReason: InvocationErrorCode.FUNCTION_RETRY_REQUEST,
});
});
In the logs I can see the following log statements:
2024-02-29 14:53:07.680 { "_retry":true, "retryOptions":{"retryAfter":123,"retryData":{},"retryReason":"FUNCTION_RETRY_REQUEST"}}
2024-02-29 14:53:07.698 {"message":"","name":"FUNCTION_ERR","stack":""}
Any idea why the FUNCTION_ERR
appears? Is that intentional? If so, why is my consumer not called again? As far as I understand, using InvocationError
is the expected way to retry a message, right?