fix(js-sdk): correctly handle interact timeout units by EaCognitive · Pull Request #3425 · firecrawl/firecrawl · GitHub
Skip to content

fix(js-sdk): correctly handle interact timeout units#3425

Open
EaCognitive wants to merge 1 commit intofirecrawl:mainfrom
EaCognitive:fix-interact-timeout
Open

fix(js-sdk): correctly handle interact timeout units#3425
EaCognitive wants to merge 1 commit intofirecrawl:mainfrom
EaCognitive:fix-interact-timeout

Conversation

@EaCognitive
Copy link
Copy Markdown

@EaCognitive EaCognitive commented Apr 23, 2026

Fixes #3407

Description
The interact() method in the JavaScript SDK expects the timeout parameter to be expressed in seconds (up to 300) per the Firecrawl API. However, the Axios request interceptor was treating this value as milliseconds and adding 5000 to it (e.g., 300 + 5000 = 5300 ms). This caused interactions to prematurely timeout locally after ~5.3 seconds.

This PR fixes the issue by intercepting requests explicitly routed to the /interact endpoint and converting the supplied timeout value from seconds to milliseconds before applying it to the Axios configuration.


Summary by cubic

Fixes premature timeouts in the JS SDK by converting interact() timeouts from seconds to milliseconds in the axios request interceptor, aligning with the Firecrawl API and preventing ~5.3s local timeouts.

  • Bug Fixes
    • For requests to /interact, multiply data.timeout by 1000; other endpoints still use milliseconds.
    • Keep the existing +5000 ms buffer when setting the request timeout.

Written for commit 81c830d. Summary will update on new commits.

The /interact endpoint expects the timeout in seconds, whereas other endpoints expect milliseconds. This fixes a bug where the Axios timeout for interact requests was set to 5000 + the timeout value in seconds, leading to premature timeouts.
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Interact() timeout is used both as API seconds and Axios milliseconds

1 participant