Skip to content

Commit 9f0e031

Browse files
committed
fix: ensure receiptHandle is present before releasing SQS messages to prevent errors
1 parent 203c0a3 commit 9f0e031

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/drivers/sqs.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,14 @@ export class SqsQueue<TJobMap = Record<string, any>> extends Queue<TJobMap, SqsJ
110110
}
111111

112112
protected async release(message: QueueMessage): Promise<void> {
113-
if (message.meta.receiptHandle) {
114-
await this.client.deleteMessage({
115-
QueueUrl: this.queueUrl,
116-
ReceiptHandle: message.meta.receiptHandle
117-
});
113+
if (!message.meta.receiptHandle) {
114+
throw new Error('Cannot release SQS message: receiptHandle is missing from metadata');
118115
}
116+
117+
await this.client.deleteMessage({
118+
QueueUrl: this.queueUrl,
119+
ReceiptHandle: message.meta.receiptHandle
120+
});
119121
}
120122

121123
async status(id: string): Promise<JobStatus> {

0 commit comments

Comments
 (0)