fix: use native fetch instead of node-fetch for Node 18+ compatibility#70
Merged
JdaieLin merged 1 commit intoMay 11, 2026
Merged
Conversation
node-fetch v3 is ESM-only, which causes "require() of ES Module not supported" errors when used in CommonJS projects with Node 18+. This change: - Removes the node-fetch dependency from proxy-fetch - Uses Node.js native fetch (available since Node 18) - Continues to support proxy via undici's ProxyAgent when configured Since the project targets Node 20, native fetch is always available. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
node-fetchdependency from proxy-fetch modulefetch(available since Node 18)ProxyAgentwhen configuredProblem
node-fetchv3 is ESM-only, which causes errors when used in CommonJS projects with Node 18+:This breaks OpenAI API calls and other cloud API integrations.
Solution
Since the project targets Node 20 (installed via
install_dependencies.sh), we can use the nativefetchAPI instead ofnode-fetch. This eliminates the ESM compatibility issue while maintaining proxy support.Test plan
🤖 Generated with Claude Code