-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(http): add configurable timeout for API block requests #2519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Conversation
… fixes, subflow resize clamping
…ribe, auth checks, new db indexes
…dioai#2481) The realtime service network policy was missing the custom egress rules section that allows configuration of additional egress rules via values.yaml. This caused the realtime pods to be unable to connect to external databases (e.g., PostgreSQL on port 5432) when using external database configurations. The app network policy already had this section, but the realtime network policy was missing it, creating an inconsistency and preventing the realtime service from accessing external databases configured via networkPolicy.egress values. This fix adds the same custom egress rules template section to the realtime network policy, matching the app network policy behavior and allowing users to configure database connectivity via values.yaml.
…rovements, additional kb tag types
Adds timeout parameter to HTTP request tool and API block: - Default timeout: 120000ms (2 minutes) - Max timeout: 600000ms (10 minutes) - User-friendly error message on timeout This allows users to configure longer timeouts for slow API endpoints. Fixes simstudioai#2242
|
@majiayu000 is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR adds configurable timeout support to the API Block, addressing issue #2242 where workflows were timing out on slow API endpoints. The implementation includes:
The timeout flows through the execution chain: API Block UI → Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant APIBlock as API Block UI
participant ExecuteTool as executeTool()
participant HandleInternal as handleInternalRequest()
participant Fetch as fetch() with AbortSignal
participant ExternalAPI as External API
User->>APIBlock: Configure API call with timeout (e.g., 300000ms)
APIBlock->>ExecuteTool: Execute with params {url, method, headers, body, timeout}
ExecuteTool->>HandleInternal: Forward params with timeout
HandleInternal->>HandleInternal: Validate & parse timeout<br/>(default: 120000ms, max: 600000ms)
HandleInternal->>Fetch: Create AbortSignal.timeout(timeoutMs)
Fetch->>ExternalAPI: HTTP Request with timeout signal
alt Request completes before timeout
ExternalAPI-->>Fetch: Response
Fetch-->>HandleInternal: Success response
HandleInternal-->>ExecuteTool: ToolResponse with data
ExecuteTool-->>User: Success with API response
else Request times out
Fetch-->>HandleInternal: TimeoutError
HandleInternal-->>HandleInternal: Catch error, check error.name === 'TimeoutError'
HandleInternal-->>ExecuteTool: Error: "Request timed out after Xms. Consider increasing the timeout value."
ExecuteTool-->>User: User-friendly timeout error message
end
|
The previous implementation only added timeout to handleInternalRequest, but external API requests go through handleProxyRequest which was missing the timeout logic. This caused the proxy fetch to use default timeout instead of the user-configured value. - Add timeout parsing logic to handleProxyRequest - Add AbortSignal.timeout to proxy fetch call - Add user-friendly timeout error message Fixes the issue reported by @ARNOLDAJEE where 600000ms timeout setting was not taking effect for external API requests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@ARNOLDAJEE I've identified and fixed the issue! Root Cause: The timeout was only implemented in Fix: Added the same timeout logic to
The fix has been pushed. Could you please test again after this PR is merged? |
Add comprehensive unit tests to verify: - Numeric timeout parsing - String timeout parsing - MAX_TIMEOUT_MS cap (600000ms) - DEFAULT_TIMEOUT_MS fallback (120000ms) - Invalid value handling - AbortSignal.timeout integration - Timeout error identification 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Test plan
Fixes #2242