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
@@ -362,18 +362,120 @@ You can reset an idempotency key to clear it from all associated runs. This is u
362
362
363
363
When you reset an idempotency key, it will be cleared for all runs that match both the task identifier and the idempotency key in the current environment. This allows you to trigger the task again with the same key.
364
364
365
+
### API signature
366
+
367
+
```ts
368
+
idempotencyKeys.reset(
369
+
taskIdentifier: string,
370
+
idempotencyKey: IdempotencyKey|string|string[],
371
+
options?: {
372
+
scope?: "run"|"attempt"|"global";
373
+
parentRunId?:string;
374
+
attemptNumber?:number;
375
+
}
376
+
)
377
+
```
378
+
379
+
| Parameter | Description |
380
+
| --- | --- |
381
+
|`taskIdentifier`| The identifier of the task (e.g., `"my-task"`) |
382
+
|`idempotencyKey`| The idempotency key to reset. Can be an `IdempotencyKey` from `create()`, a raw string, or a string array |
383
+
|`options.scope`| The scope used when the key was created. Defaults to `"run"`|
384
+
|`options.parentRunId`| Required for `"run"` or `"attempt"` scope when called outside a task context |
385
+
|`options.attemptNumber`| Required for `"attempt"` scope when called outside a task context |
386
+
387
+
### Resetting keys created with `idempotencyKeys.create()`
388
+
389
+
When you pass an `IdempotencyKey` created with `idempotencyKeys.create()`, the scope and original key are automatically extracted, making it easy to reset:
Keys created with `"run"` scope (the default) include the parent run ID in the hash. When resetting from inside the same task, the run ID is automatically available:
-`taskIdentifier`: The identifier of the task (e.g., `"my-task"`)
374
-
-`idempotencyKey`: The idempotency key to reset
464
+
<Warning>
465
+
If you try to reset a `"run"` or `"attempt"` scoped key from outside a task without providing the required `parentRunId` (and `attemptNumber` for attempt scope), it will throw an error.
466
+
</Warning>
467
+
468
+
### Resetting from the dashboard
375
469
376
-
After resetting, any subsequent triggers with the same idempotency key will create new task runs instead of returning the existing ones.
470
+
You can also reset idempotency keys directly from the Trigger.dev dashboard:
471
+
472
+
1. Navigate to the run that has the idempotency key you want to reset
473
+
2. In the run details panel, find the "Idempotency key" section
474
+
3. Click the "Reset" button
475
+
476
+
This is useful when you need to manually allow a task to be re-triggered without writing code.
477
+
478
+

377
479
378
480
<Note>
379
481
Resetting an idempotency key only affects runs in the current environment. The reset is scoped to the specific task identifier and idempotency key combination.
@@ -397,8 +499,4 @@ The scope determines what gets hashed alongside your key:
397
499
398
500
This is why understanding scopes is crucial: the same string key can produce different idempotency behavior depending on the scope and context.
399
501
400
-
### Viewing scope in the dashboard
401
-
402
-
When you view a run in the Trigger.dev dashboard, you can see both the idempotency key and its scope in the run details panel. This helps you debug idempotency issues by understanding exactly how the key was configured.
403
502
404
-

0 commit comments