-
Notifications
You must be signed in to change notification settings - Fork 212
fix: node fetch timeout #1217
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: main
Are you sure you want to change the base?
fix: node fetch timeout #1217
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
@vachmara, Thank you for raising this PR. I have created an internal bug for the review. |
hkt74
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for resolve the last comments quickly, I did a second review using Gemini
Perfect, thank you! Let me know if you need anything else |
hkt74
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did more tests locally with your change and triggered the github actions
- Need to add 'undici' in
rollup.config.mjs- externalDeps - fix the github actions
|
Not sure the coverage CI is related to this change, is everything still okay? |
hkt74
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could the coverage CI related to the change in the package.json file?
/home/runner/work/js-genai/js-genai/dist/src/cross/sentencepiece/sentencepiece_model.pb.js
|
@vachmara I will take a look coverage test |
|
looks like the coverage test is failing for other pr as well, I think we can skip it for now |
|
Perfect, thanks for addressing this! |

Fix #712
This pull request updates how the
undiciHTTP client library is managed and integrated in the project, moving it from a direct dependency to a peer dependency, and adds improved Node.js HTTP timeout handling usingundici'sAgent. It also introduces corresponding test coverage for this new behavior.Dependency management:
undiciandundici-typestopeerDependenciesinpackage.json, and marked them as optional inpeerDependenciesMeta. This makes them optional peer dependencies instead of always-installed direct dependencies.Node.js HTTP request improvements:
src/_api_client.ts, updated the request logic to dynamically importundiciand set a customAgentwith timeout options for Node.js environments, improving HTTP timeout handling.Testing:
test/unit/api_client_test.tsto verify that thedispatcherwith timeouts is set on HTTP requests in Node.js, and imported the requiredAgentand types fromundicifor testing.Shout out to @yulisunny for spotting the issue, I tested this on vercel it's working!