Commit 2bf9ae4
committed
fix(core): preserve storage-node side effect + env fallback for inheritContext scopes
Two follow-ups from review of the TriggerClient PR:
1. The bare side-effect import `import "@trigger.dev/core/v3/sdk-scope-storage"`
from SDK code (triggerClient.ts, auth.ts) was at risk of being
tree-shaken away by bundlers that respect `"sideEffects": false`
on `@trigger.dev/core`. Whitelist the storage-node module in core's
`sideEffects` array so bundlers keep the install side effect.
Without this, the scope silently degrades to no-op in production
bundles even though Node-runtime tests pass.
2. `auth.withAuth({ baseURL: "..." }, fn)` regressed for callers
relying on `TRIGGER_SECRET_KEY` from the env: the scoped
accessToken getter returned undefined instead of falling back to
the env var, so a partial override (just baseURL) broke auth.
Restore env fallback inside the scope, but gate it on
`inheritContext: true` so it only applies to withAuth-style scopes,
not to TriggerClient instances (whose isolation guarantee requires
identity fields to come only from the constructor config).
Adds an `auth.withAuth` test that covers the partial-override-with-env
case so the regression can't return.1 parent 878b5a4 commit 2bf9ae4
3 files changed
Lines changed: 48 additions & 4 deletions
File tree
- packages
- core
- src/v3/apiClientManager
- trigger-sdk/src/v3
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
175 | 179 | | |
176 | 180 | | |
177 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
54 | 65 | | |
55 | 66 | | |
56 | 67 | | |
| |||
64 | 75 | | |
65 | 76 | | |
66 | 77 | | |
67 | | - | |
68 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
69 | 89 | | |
70 | 90 | | |
71 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
204 | 224 | | |
205 | 225 | | |
206 | 226 | | |
| |||
0 commit comments