Skip to content

Commit 88a302a

Browse files
committed
docs(management): note the withAuth fallback on runtimes without AsyncLocalStorage
1 parent 132e516 commit 88a302a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

docs/management/authentication.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,10 @@ const projectBRuns = await auth.withAuth(
180180
Any SDK call inside the callback uses the overridden config. Calls outside the callback continue to use whatever was set by `configure` (or picked up from `TRIGGER_SECRET_KEY`).
181181

182182
The override is scoped via [AsyncLocalStorage](https://nodejs.org/api/async_context.html), so concurrent `auth.withAuth` calls (including overlapping calls inside `Promise.all` with different tokens) do not interfere. Nested calls compose — an inner `auth.withAuth({ accessToken })` inside an outer `auth.withAuth({ baseURL })` runs with both fields applied.
183+
184+
<Note>
185+
On runtimes without AsyncLocalStorage (browsers and some edge runtimes), the SDK falls back to
186+
swapping the global config in place for the duration of the callback, which is not safe under
187+
concurrency. If you need concurrent multi-target calls there, use
188+
[`new TriggerClient({...})`](/management/multiple-clients) instances instead.
189+
</Note>

0 commit comments

Comments
 (0)