Trigger.dev
Connect
Connect Trigger.dev from the terminal. Pass --help for the flags Trigger.dev accepts, plus --no-browser for headless environments.
polylane cloud connect --provider triggerdevAn environment secret key created with the "No restrictions" preset, from the environment's API Keys page.
Connect one Trigger.dev environment with its secret key. The key selects the environment: a prod key connects production, and a staging key connects staging, each as a separate account. There is no staging switch. Polylane monitors an environment from the moment you connect it. To stop its checks, turn off Anomaly detection in the account settings.
- In Trigger.dev, open the API Keys page of the environment and create a key with the "No restrictions" preset.
- Paste the key into Polylane and press Connect. The key names its project and environment, so you do not type anything else.
The key can read Trigger.dev data, including environment variables, and request changes through the Trigger.dev API. Each change needs safety review and approval. Keep Read-only on in the account settings to allow reads only.
Polylane encrypts the key before it stores it. To send run failures to Polylane, add a webhook alert as described under Webhook alerts.
Connect Trigger.dev from a CI job or any other environment without a browser.
Connecting Trigger.dev needs no browser: the same endpoint the console calls fits in a CI job. One authenticated POST creates the connection and starts the first sync.
Prerequisites
- A Polylane API key with the
cloud_accounts:writeandcloud_accounts:readscopes. See API keys and OAuth. - Your workspace ID, which starts with
ws_. Read it fromGET /v1/workspaceswith the same key. - A Trigger.dev environment secret key (
tr_prod_sk_…ortr_stg_sk_…) from your project's prod or staging environment, under API Keys. Create it with the No restrictions preset: Polylane reads the project's identity through an endpoint only a "No restrictions" key can call, so Trigger only, Observer, Deploy only, Task operator and Variables only keys are refused, and so are dev and preview keys.
Create the connection
curl -X POST https://api.polylane.com/v1/cloud_accounts \
-H "x-api-key: $POLYLANE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"provider": "triggerdev",
"workspaceId": "ws_0abc123",
"apiKey": "<environment-secret-key>"
}'
The key names its own project and environment, and a key belongs to exactly one environment, so one call connects one environment: a prod key connects production and a staging key connects staging, each as its own account. Posting a key for an environment that is already connected replaces the account's key. There is no environment toggle to set. Connecting an environment is how you choose to watch it.
The response lists what was connected, with the first sync already running. Trimmed to the two fields the rest of the flow reads:
{
"success": true,
"result": {
"provider": "triggerdev",
"accounts": [{ "id": "acc_34gky74ibc92h8t2efn8csrh", "status": "syncing" }],
"failures": []
}
}
A key the API refuses lands in failures instead of accounts, with the message saying why, so repeating the call never duplicates a connection.
Wait for the first sync
Poll each returned account by its id until status reaches ready (new on registration, syncing while resources stream in):
until [ "$(curl -s "https://api.polylane.com/v1/cloud_accounts/$WORKSPACE_ID/$ACCOUNT_ID" \
-H "x-api-key: $POLYLANE_API_KEY" | jq -r '.result.status')" = "ready" ]; do
sleep 15
done
Give the loop a deadline so a failed connect fails the job instead of hanging it. Once the account is ready, its resources are in the topology and Polylane has started its first check.
Disconnect from the API
Deleting the connection stops every sync and check and deletes the credentials Polylane held. The call needs the cloud_accounts:delete scope:
curl -X DELETE "https://api.polylane.com/v1/cloud_accounts/$WORKSPACE_ID/$ACCOUNT_ID" \
-H "x-api-key: $POLYLANE_API_KEY"
Then delete the Trigger.dev key and webhook alert, as described under Disconnecting.
How it works
Resources in the context graph
Polylane maps the environment, its deployments with the current one, tasks, schedules and queues. A task that appears in runs but not in the current version stays in the graph with a flag. Polylane syncs every 15 minutes, and records a deployment event when the current deployment changes. Runs are not resources in the graph. Polylane reads them when it needs them.
Checks and anomaly detection
Polylane reads your runs with TRQL, the SQL dialect of Trigger.dev. Nine account checks watch the environment:
- the share of finished runs that failed, crashed or had a system failure
- crashed runs, runs that time out at
maxDuration, and runs that expire in the queue - the p95 queue wait time and the number of queued runs
- failed deployments
- schedules that missed a run
- new error groups
The same checks also run for each of your 20 busiest tasks of the last day, so a failing task has its own name in the issue. Each chart and number widget on your Trigger.dev query dashboards becomes a check too. Tasks, schedules and the environment also get their own monitors, which read the runs, the logs and traces of recent failed runs, and queue metrics.
Run failures become issues
With the webhook alert, a failed run opens an issue, or adds to the open issue for the same task and error. An out-of-memory failure is critical. Test runs are skipped. Deployment events from the alert go to watches on the environment, but they do not open issues. The failed deployments check catches a failed deployment. Polylane triages each issue and investigates it.
What agents can do
During an investigation, agents query run history with TRQL, list and read runs with their attempts, read error groups, and read the trace tree and log events of a run. They also read deployments, schedules, queues and queue metrics, and can set a watch that wakes a thread when the next deployment lands.
Webhook alerts
Trigger.dev webhook alerts send run failures and deployment events to Polylane. Add one alert for each environment:
- On the Alerts page of the environment, add a webhook alert. Use the URL from the Webhooks card on the account's Settings page in Polylane. It has the form
https://sinks.polylane.com/v1/triggerdev/<project ref>/<environment slug>. - Select the "Task run failure", "Deployment failure" and "Deployment success" events.
- Trigger.dev shows a signing secret one time. Paste it into the same Webhooks card.
Polylane checks the signature of each delivery with that secret, and refuses a delivery that it already received.
Troubleshooting
"Polylane needs a key created with the 'No restrictions' preset"
- Polylane reads the identity of the project through an endpoint that only a "No restrictions" key can call. Trigger only, Observer, Deploy only, Task operator and Variables only keys do not work. Create a "No restrictions" key on the API Keys page of the environment and connect it.
"Trigger.dev did not recognize this key"
- Make sure you copied the full key and that it is not revoked.
"Dev keys only work while trigger dev runs" and "Preview keys are per branch and not supported"
- Use a prod or staging key.
Webhook deliveries do not arrive
- The signing secret must be the secret that Trigger.dev showed for the alert of this environment. If you created the alert again, save its new secret.
- Each alert needs the URL from the Webhooks card of its own environment. Polylane refuses a payload that names a different environment or project with a 400.
Missing resources
- Click Sync in the account header to sync before the next scheduled sync.
Disconnecting
Disconnecting does not change Trigger.dev. Delete the webhook alert on the Alerts page of the environment, and delete the key on its API Keys page.
Disconnect
Disconnecting stops every sync and check and deletes the credentials Polylane held. Polylane removes what Trigger.dev's API lets it remove. The following stays until you remove it yourself:
- Trigger.dev webhook alert
polylane cloud disconnect <id>Tools
5Operations agents can perform in threads.
Supported resources
5Resource types that show up in your infrastructure graph.