Skip to content

EnvHttpProxyAgent invalid onError method #63757

@legendecas

Description

@legendecas

Version

26.3.0

Platform

windows

Subsystem

No response

What steps will reproduce the bug?

Run npm test in https://github.com/nodejs/node-addon-api/ with an http_proxy env set.

How often does it reproduce? Is there a required condition?

Reproducible with node >= v26.1.0 (v26.2.0, v26.3.0)

Not reproducible with node 26.0.0, or 24.x.

I also tested on mac, and it is not reproducible. Seems like a Windows only issue.

What is the expected behavior? Why is that the expected behavior?

$ npm run test

> node-addon-api@8.8.0 pretest
> node-gyp rebuild -C test

gyp info it worked if it ends with ok
gyp info using node-gyp@12.3.0
gyp info using node@26.1.0 | win32 | x64
gyp info chdir test
gyp info find Python using Python version 3.14.5 found at "C:\Users\cwu631\AppData\Local\Programs\Python\Python314\python.exe"

gyp http GET https://nodejs.org/download/release/v26.1.0/node-v26.1.0-headers.tar.gz
(node:31964) [UNDICI-EHPA] Warning: EnvHttpProxyAgent is experimental, expect them to change at any time.
(Use `node --trace-warnings ...` to show where the warning was created)
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack InvalidArgumentError: invalid onError method
gyp ERR! stack at EnvHttpProxyAgent.dispatch (C:\Users\cwu631\AppData\Local\nvm\v26.1.0\node_modules\npm\node_modules\undici\lib\dispatcher\dispatcher-base.js:188:15)
gyp ERR! stack at node:internal/deps/undici/undici:13941:57
gyp ERR! stack at new Promise (<anonymous>)
gyp ERR! stack at dispatchWithProtocolPreference (node:internal/deps/undici/undici:13941:18)
gyp ERR! stack at dispatch (node:internal/deps/undici/undici:13939:16)
gyp ERR! stack at httpNetworkFetch (node:internal/deps/undici/undici:13837:73)
gyp ERR! stack at httpNetworkOrCacheFetch (node:internal/deps/undici/undici:13707:39)
gyp ERR! stack at httpFetch (node:internal/deps/undici/undici:13529:43)
gyp ERR! stack at schemeFetch (node:internal/deps/undici/undici:13446:18)
gyp ERR! stack at mainFetch (node:internal/deps/undici/undici:13290:30)
gyp ERR! System Windows_NT 10.0.26100
gyp ERR! command "C:\\Users\\cwu631\\AppData\\Local\\nvm\\v26.1.0\\node.exe" "C:\\Users\\cwu631\\AppData\\Local\\nvm\\v26.1.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "-C" "test"
gyp ERR! cwd C:\dev\nodejs\node-addon-api\test
gyp ERR! node -v v26.1.0
gyp ERR! node-gyp -v v12.3.0
gyp ERR! $npm_package_name node-addon-api
gyp ERR! $npm_package_version 8.8.0
gyp ERR! not ok

What do you see instead?

The gyp rebuild should successfully download the header.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    addonsIssues and PRs related to native addons.npmIssues and PRs related to the npm client dependency or the npm registry.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions