Skip to content

Commit c059570

Browse files
authored
docs: clarify .env.local loading and idempotency key reset scope (#2996)
Document that .env.local is automatically loaded during dev, and clarify that backend-triggered idempotency keys should be reset with global scope
1 parent 6a45f56 commit c059570

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

docs/deploy-environment-variables.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ You can edit an environment variable's values. You cannot edit the key name, you
6666

6767
</Steps>
6868

69+
## Local development
70+
71+
When running `npx trigger.dev dev`, the CLI automatically loads environment variables from these files in order (later files override any duplicate keys from earlier ones):
72+
73+
- `.env`
74+
- `.env.development`
75+
- `.env.local`
76+
- `.env.development.local`
77+
- `dev.vars`
78+
79+
These variables are available to your tasks via `process.env`. You don't need to use the `--env-file` flag for this automatic loading.
80+
6981
## In your code
7082

7183
You can use our SDK to get and manipulate environment variables. You can also easily sync environment variables from another service into Trigger.dev.

docs/idempotency.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,18 +428,22 @@ export const parentTask = task({
428428
});
429429
```
430430

431-
When resetting from outside a task (e.g., from your backend code), you must provide the `parentRunId`:
431+
When resetting from outside a task, you must provide the `parentRunId` if the key was created within a task context:
432432

433433
```ts
434434
import { idempotencyKeys } from "@trigger.dev/sdk";
435435

436-
// From your backend code - you need to know the parent run ID
436+
// If the key was created within a task, you need the parent run ID
437437
await idempotencyKeys.reset("my-task", "my-key", {
438438
scope: "run",
439439
parentRunId: "run_abc123"
440440
});
441441
```
442442

443+
<Note>
444+
If you triggered the task from backend code, all scopes behave as global (see [Triggering from backend code](#triggering-from-backend-code)). Use `scope: "global"` when resetting.
445+
</Note>
446+
443447
### Resetting attempt-scoped keys
444448

445449
Keys created with `"attempt"` scope include both the parent run ID and attempt number. When resetting from outside a task, you must provide both:

0 commit comments

Comments
 (0)