Commit f50f437
committed
fix(webapp): let the dashboard agent target a different Trigger instance
The agent session-start, token mint, head-start, in-proxy and the client
transport all used the webapp's own origin (API_ORIGIN ?? APP_ORIGIN) as the
agent instance. That only holds when the agent project runs on the same instance
as the webapp. When it doesn't — e.g. a test-cloud webapp using the shared agent
project on prod cloud — DASHBOARD_AGENT_SECRET_KEY is a prod-cloud key sent to
test-cloud's API, which rejects it ("Invalid API key") and the chat can't start.
Add an optional DASHBOARD_AGENT_BASE_URL. dashboardAgentApiOrigin() now returns
it, or the SDK default (https://api.trigger.dev) when unset — never the webapp's
own origin, and independent of TRIGGER_API_URL (which the webapp may point at an
internal host). All server call sites already funnel through that function; the
client transport gets the value via the root loader and a useDashboardAgentBaseUrl
hook, replacing the general useApiOrigin in the panel.
Unset (prod cloud) resolves to the SDK default, matching today's behavior. Test
cloud sets DASHBOARD_AGENT_BASE_URL=https://api.trigger.dev.1 parent ce40d02 commit f50f437
5 files changed
Lines changed: 13 additions & 3 deletions
File tree
- apps/webapp/app
- components/dashboard-agent
- hooks
- services
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
0 commit comments