I am calling an external API in my azure storage queue trigger which itself, is initiated by another endpoint. Calling the external API might fail, therefore I would like throw an error so that my host.json parameters will apply:
"extensions": {
"queues": {
"maxPollingInterval": "00:00:01",
"visibilityTimeout": "00:00:30",
"batchSize": 16,
"maxDequeueCount": 5,
"newBatchThreshold": 8,
"messageEncoding": "base64"
}
}
Simplified code:
export async function cashbackStorageQueueTrigger(
queueItem: unknown,
context: InvocationContext
): Promise<void> {
try {
const {
// ...props
} = queueItem;
// Requesting the cashback
} catch (error) {
context.error("Error processing cashback request: ", error);
throw new Error(`Error processing cashback request: ${error}`);
}
}
The above code does not trigger the storageQueueTrigger again. Invocation Details show "succeeded" even though the API call has failed. Am I doing something wrong?