Skip to content

Commit c553769

Browse files
committed
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.
1 parent 90e8bd5 commit c553769

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/trigger-sdk/src/v3/wait.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ async function retrieveToken<T>(
269269
let output: T | undefined = undefined;
270270

271271
if (result.outputIsError) {
272-
error = new WaitpointTimeoutError(data.message);
272+
error = new WaitpointTimeoutError(data?.message ?? "Waitpoint timed out");
273273
} else {
274274
output = data as T;
275275
}
@@ -615,7 +615,7 @@ export const wait = {
615615
output: data,
616616
} as WaitpointTokenTypedResult<T>;
617617
} else {
618-
const error = new WaitpointTimeoutError(data.message);
618+
const error = new WaitpointTimeoutError(data?.message ?? "Waitpoint timed out");
619619

620620
span.recordException(error);
621621
span.setStatus({

0 commit comments

Comments
 (0)