Skip to content

Commit 1400ed8

Browse files
committed
docs: document the TRIGGER_DASHBOARD_URL run environment variable
1 parent 4d11d10 commit 1400ed8

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎docs/deploy-environment-variables.mdx‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,25 @@ The context object provides:
192192

193193
For more information about the context object, see the [Context documentation](/context).
194194

195+
#### Linking to a run in the dashboard
196+
197+
Trigger.dev sets `TRIGGER_DASHBOARD_URL` on every run, in development and deployed environments. Its value is the dashboard's address without a trailing slash, so it also points at your own instance when you self-host. Append `/runs/<runId>` to link to a run:
198+
199+
```ts
200+
import { task } from "@trigger.dev/sdk";
201+
202+
export const reportTask = task({
203+
id: "report-task",
204+
run: async (payload, { ctx }) => {
205+
const runUrl = `${process.env.TRIGGER_DASHBOARD_URL}/runs/${ctx.run.id}`;
206+
207+
console.log(`View this run: ${runUrl}`);
208+
},
209+
});
210+
```
211+
212+
The `/runs/<runId>` link checks that the viewer is a member of the run's organization, then redirects to the full run page. If you set your own `TRIGGER_DASHBOARD_URL` environment variable on the project, your value is used instead.
213+
195214
### Sync env vars from another service
196215

197216
There are two ways to pull secrets from another service into Trigger.dev: a native **Secret Sync** (currently [Infisical](https://infisical.com)), or the `syncEnvVars` build extension for any other service.

0 commit comments

Comments
 (0)