From c55376963b70e718fa07bd4e7d80c99eaaf73e0d Mon Sep 17 00:00:00 2001 From: okxint Date: Sun, 9 Aug 2026 18:26:54 +0530 Subject: [PATCH 1/2] fix(sdk): guard against null output in wait token timeout error When a waitpoint token times out but has no output payload (output=null in the DB), data is undefined. Accessing data.message throws a TypeError that crashes the runtime before the timeout error is returned to the caller. Use optional chaining with a fallback message to match the pattern already used in sharedRuntimeManager for the same scenario. --- packages/trigger-sdk/src/v3/wait.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/trigger-sdk/src/v3/wait.ts b/packages/trigger-sdk/src/v3/wait.ts index 934870b277e..47a0b53ec35 100644 --- a/packages/trigger-sdk/src/v3/wait.ts +++ b/packages/trigger-sdk/src/v3/wait.ts @@ -269,7 +269,7 @@ async function retrieveToken( let output: T | undefined = undefined; if (result.outputIsError) { - error = new WaitpointTimeoutError(data.message); + error = new WaitpointTimeoutError(data?.message ?? "Waitpoint timed out"); } else { output = data as T; } @@ -615,7 +615,7 @@ export const wait = { output: data, } as WaitpointTokenTypedResult; } else { - const error = new WaitpointTimeoutError(data.message); + const error = new WaitpointTimeoutError(data?.message ?? "Waitpoint timed out"); span.recordException(error); span.setStatus({ From b2656648ae5b0add850053f423ffec79c0da0bc4 Mon Sep 17 00:00:00 2001 From: okxint Date: Sun, 9 Aug 2026 18:27:26 +0530 Subject: [PATCH 2/2] chore: add changeset for wait token null output fix --- .changeset/fix-wait-token-null-output-crash.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fix-wait-token-null-output-crash.md diff --git a/.changeset/fix-wait-token-null-output-crash.md b/.changeset/fix-wait-token-null-output-crash.md new file mode 100644 index 00000000000..bd8091df07a --- /dev/null +++ b/.changeset/fix-wait-token-null-output-crash.md @@ -0,0 +1,5 @@ +--- +"@trigger.dev/sdk": patch +--- + +Fix crash when a timed-out waitpoint token has no output payload. When `result.output` is null, `data` is `undefined` and accessing `data.message` throws a `TypeError` before the timeout error reaches the caller. Uses optional chaining with a fallback message, matching the pattern already used in `sharedRuntimeManager` for the same case.