You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: If you use a custom authorization method to secure your workflow endpoint, add authorization to the `failureFunction` too. Otherwise, anyone could invoke your failure function. Read more here: [securing your workflow endpoint](/workflow/howto/security).
74
+
Note: If you use a custom authorization method to secure your workflow endpoint, add authorization to the `failureFunction` too. Otherwise, anyone can invoke your failure function. Read more here: [securing your workflow endpoint](/workflow/howto/security).
74
75
75
76
In `@upstash/workflow`, the `failureFunction` can optionally return a string value that will be displayed in the UI (coming soon) and included in the workflow logs. This is useful for providing custom error messages, debugging information, or tracking specific failure conditions.
76
77
77
78
## Using a `failureUrl`
78
79
79
-
The `failureUrl` handles cases where the service hosting your workflow URL is unavailable. In this case, a workflow failure notification is sent to another reachable endpoint.
80
+
Instead of using the built-in failure function, you can define a separate failure callback URL.
81
+
Unlike the failure function, which only works when your application is running, the failure URL allows you to handle errors even if your application is completely down.
82
+
If the URL is a different service other than your application, it will be reachable in these cases.
83
+
84
+
By pointing the failure URL to an external service (not hosted within your main application), you ensure that it remains accessible even when your primary app is unavailable.
`verifySignature` allows to verify the signature of request, which is signed by Upstash using your signing keys.
154
+
If you don't want to verify the signature, you can remove `QSTASH_CURRENT_SIGNING_KEY` and `QSTASH_NEXT_SIGNING_KEY` environment variables and remove `verifySignature` function.
155
+
156
+
157
+
158
+
## Manually Handling Failed Workflow Runs
159
+
160
+
When a workflow run fails and is moved to the Dead Letter Queue (DLQ), you have several options to handle it manually via the REST API:
161
+
162
+
### [Resume](/workflow/rest/dlq/resume)
163
+
-**What it does:** Continues a failed workflow run from exactly where it failed, preserving all successful step results.
164
+
-**When to use:** Use this if you want to retry only the failed/pending steps without re-executing the entire workflow.
165
+
166
+
### [Restart](/workflow/rest/dlq/restart)
167
+
-**What it does:** Starts the failed workflow run over from the beginning, discarding all previous step results.
168
+
-**When to use:** Use this if you want a clean execution, or if the failure may have been caused by a corrupted state that requires a fresh start.
169
+
170
+
### [Callback](/workflow/rest/dlq/callback)
171
+
-**What it does:** Reruns the failure callback for a workflow run, in case the original failure callback was not delivered or failed.
172
+
-**When to use:** Use this to ensure your system is notified of workflow failures, even if the original callback attempt did not succeed.
173
+
174
+
101
175
## Debugging failed runs
102
176
103
177
In your DLQ, filter messages via the `Workflow URL` or `Workflow Run ID` to search for a particular failure. We include all request and response headers and bodies to simplify debugging failed runs.
If the failure callback for a workflow run has failed, you can use this endpoint to manually trigger the failure callback again.
9
+
This is useful for ensuring that your system is notified of workflow failures even if the original callback attempt did not succeed.
10
+
11
+
The state of the failure callback for each workflow run is included in the DLQ message response as failureCallbackInfo.state.
12
+
You can filter for all workflow runs with a failed failure callback by using the failureCallbackState filter when listing workflow runs in the DLQ with the `/v2/workflows/dlq` endpoint.
13
+
14
+
## Request
15
+
16
+
<ParamFieldpath="dlqId"type="string"required>
17
+
The DLQ id of the failed workflow run for which you want to rerun the failure callback. You can find this id when listing all workflow runs in the DLQ with the [/v2/workflows/dlq](/workflow/rest/dlq/list) endpoint.
18
+
</ParamField>
19
+
20
+
## Response
21
+
22
+
<ResponseFieldname="workflowRunId"type="string">
23
+
The ID of the workflow run for which the failure callback was rerun.
Delete a failed workflow run from the Dead Letter Queue (DLQ).
9
+
10
+
When a workflow run fails, it is moved to the DLQ. You can manually remove a failed workflow run from the DLQ using this endpoint. This is useful for cleaning up failed runs that you no longer wish to retry or analyze.
11
+
12
+
## Request
13
+
14
+
<ParamFieldpath="dlqId"type="string">
15
+
The DLQ id of the failed workflow run you want to remove. You will see this id when
16
+
listing all workflow runs in the DLQ with the [/v2/workflows/dlq](/workflow/rest/dlq/list) endpoint.
17
+
</ParamField>
18
+
19
+
## Response
20
+
21
+
The endpoint doesn't return a response body. A status code of 200 means the workflow run was removed from the DLQ.
22
+
If the workflow run is not found in the DLQ (either it has already been removed by you, or automatically), the endpoint returns a 404 status code.
0 commit comments