Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-wait-token-null-output-crash.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions packages/trigger-sdk/src/v3/wait.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ async function retrieveToken<T>(
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;
}
Expand Down Expand Up @@ -615,7 +615,7 @@ export const wait = {
output: data,
} as WaitpointTokenTypedResult<T>;
} else {
const error = new WaitpointTimeoutError(data.message);
const error = new WaitpointTimeoutError(data?.message ?? "Waitpoint timed out");

span.recordException(error);
span.setStatus({
Expand Down