upstash / qstash-js

Message queue for serverless
https://docs.upstash.com/qstash
MIT License
160 stars 15 forks source link

Trying to cancel a task #19

Closed LeandroParisi closed 1 year ago

LeandroParisi commented 1 year ago

Hello I am using QStash to process some async events. But I have to do a idempotency check and, if it fails I wanted to delete the message since it was alredy processed.

Tried doing it with the following method:

await qStashClient.messages.delete({
    id: messageId,
  })

But got this error:

QstashError: {"error":"error deleting task from queue: asynq: FAILED_PRECONDITION: cannot delete task in active state. use CancelTask instead."}

Wasn't able to find this CancelTask method, is it not implemented on this sdk yet?

chronark commented 1 year ago

Hey, messages that are currently being delivered can not be cancelled, because they request to your API is already made, that's the error you get. However it should not be forwarded to the user but handled internally instead.

You did everything right and can ignore this error.

chronark commented 1 year ago

Fixed in v2