Skip to content

Commit b92e46e

Browse files
docs: document the TRIGGER_DASHBOARD_URL run environment variable (#5049)
## Summary The environment variables page now explains `TRIGGER_DASHBOARD_URL`, with an example that builds a link to the current run from `ctx.run.id`. Runs now get this variable set to the dashboard's address on every instance, and a value set on the project still takes precedence. Based on [feat(webapp): give runs a TRIGGER_DASHBOARD_URL environment variable](7ee436b13), which added the variable to the run environment. Docs only. Mark ready for review to merge. Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
1 parent 4d11d10 commit b92e46e

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)