Skip to content

node-fetch: fetch() throws 'Function.prototype.call was called on a value that is not a function' — same message class as #5135 and the require('stream') case #10759

Description

@proggeramlug

Compiling node-fetch 3.3.2 from real source succeeds (23 modules, 3m8s), but calling fetch() throws:

Uncaught (in promise) TypeError: Function.prototype.call was called on a value that is not a function

Found by the package-compilability probe on 91a566c8af (v0.5.1605), Linux x64.

Isolated to fetch() itself, not the test scaffolding

  • A stripped-down GET-only fixture (no POST, no body) against a local node:http server still crashes — immediately after the server starts listening, before any response is read.
  • An isolated ESM harness doing http.createServer plus a Promise, with no node-fetch involved, runs clean.

So the failure is inside node-fetch's own fetch() machinery rather than in the ESM/http scaffolding around it.

This looks like a recurring class, not a one-off

That error string is Perry's generic runtime message for .call() on a non-function value, and there is prior art in-repo for the same message arising from module-shape problems:

  • crates/perry/tests/issue_5135_proxy_compound_and_function_tostring.rs
  • a comment at crates/perry-runtime/src/node_stream_dispatch.rs:230 describing the same message following require('stream')

Which suggests the underlying cause is something resolving to a non-function where a function is expected — plausibly a module-export shape — rather than a defect unique to node-fetch. Worth checking against those existing cases before treating it as new.

Reproduction

mkdir nf-probe && cd nf-probe
npm install node-fetch@3.3.2
# package.json: { "perry": { "compilePackages": ["node-fetch"] } }
# fixture.ts: start an http server, then `await fetch("http://127.0.0.1:PORT/")`
perry compile fixture.ts -o fixture && ./fixture

Not determined

Which call site inside node-fetch receives the non-function value. Narrowed to "inside fetch()", not to a specific line, within the probe's time budget.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    package-auditFound by the 2026 package audit: compiling real npm packages from source instead of native bindings

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions