Skip to content

Commit 970228e

Browse files
waleedlatif1claude
andcommitted
fix: validate timeout is positive number
Negative timeout values would cause immediate request abort since JavaScript treats negative setTimeout delays as 0. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e2023dc commit 970228e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

apps/sim/tools/utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,14 @@ export function formatRequestParams(tool: ToolConfig, params: Record<string, any
123123
}
124124
}
125125

126-
// Get timeout from params (if specified) and ensure it's a number
126+
// Get timeout from params (if specified) and ensure it's a valid positive number
127127
// The short-input subBlock returns a string, so we need to convert it
128128
const rawTimeout = params.timeout
129129
const timeout = rawTimeout != null ? Number(rawTimeout) : undefined
130+
const validTimeout =
131+
timeout != null && !Number.isNaN(timeout) && timeout > 0 ? timeout : undefined
130132

131-
return { url, method, headers, body, timeout: Number.isNaN(timeout) ? undefined : timeout }
133+
return { url, method, headers, body, timeout: validTimeout }
132134
}
133135

134136
/**

0 commit comments

Comments
 (0)