I have service bus triggered azure function app. In the function app based on some condition i want to transfer the message to dead letter queue.
const sbClient = new ServiceBusClient(connectionString);
const receiver = sbClient.createReceiver('chattopic', 'test', {
receiveMode: "receiveAndDelete"
});
console.log(serviceBusMessage);
await receiver.deadLetterMessage(serviceBusMessage, {
deadLetterReason: "Error",
deadLetterErrorDescription: "Error."
})
However i get the following error
Result: Failure
Exception: The operation is not supported in 'receiveAndDelete' receive mode.
Stack: Error: The operation is not supported in 'receiveAndDelete' receive mode.
I get same error even when i change the receiveMode to peekLock. Can anyone please help here.