You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] TypeError: e is not a constructor when HTTP_PROXY/HTTPS_PROXY env vars are set (regression in v2.33.0) #1204
Since v2.33.0, the CLI crashes at startup with TypeError: e is not a constructor whenever HTTP_PROXY, http_proxy, HTTPS_PROXY, or https_proxy environment variables are set. This is a regression introduced by PR #1196 ("update proxy-agent to newer version"), which bumped proxy-agent from 6.5.0 → 8.0.1. v2.32.0 is unaffected.
Steps to Reproduce
Set HTTP_PROXY or HTTPS_PROXY (or their lowercase variants) in your environment
The CLI should start normally and proceed with code generation, as it did in v2.32.0.
Error shown
TypeError: e is not a constructor
at Array.<anonymous> (/…/node_modules/@openapitools/openapi-generator-cli/main.js:2:374)
at o (/…/node_modules/@openapitools/openapi-generator-cli/main.js:2:53914)
...
Node.js v20.20.2
Error: Process completed with exit code 1.
Operation System
OS: Linux (self-hosted GitHub Actions runner), also reproducible on macOS
Version: Ubuntu 22.04 / macOS
Package System
npm
Additional context
The bug is in apps/generator-cli/src/app/app.module.ts (introduced in commit 15a4632, PR #1196):
proxy-agent@6.5.0 exported the class directly, so require('proxy-agent') was the constructor. proxy-agent@8.0.1 changed to named exports ... require('proxy-agent') now returns { ProxyAgent, ... } with no .default property, so the ?? fallback returns the module object, and new on a plain object throws.
yes, that's what i did before but the job failed (couldn't find proxy-agent even thought it's defined in package.json, yarn.lock) and that's why i took the suggestion from co-pilot but it turns out it won't work during runtime.
Activity
wing328 commentedon May 19, 2026
thanks for reporting the bug.
just filed #1206 to revert the change
but got errors (https://github.com/OpenAPITools/openapi-generator-cli/actions/runs/26088889697/job/76709055286?pr=1206), which is why we made the mentioned change.
do you have any clue how to fix it? would appreciate your suggestions on how to fix the issue
wing328 commentedon May 19, 2026
for those impacted by this, please pin the version to v2.32.0 for the time being.
wing328 commentedon May 19, 2026
@bux for v2.32.0, if a wrong proxy is specified, will it be ignored (no error thrown)?
I tried to added a test (https://github.com/OpenAPITools/openapi-generator-cli/pull/1206/changes#diff-5c3fa597431eda03ac3339ae6bf7f05e1a50d6fc7333679ec38e21b337cb6721R96) but it won't fail so wondering if that's the correct behaviour.
bux commentedon May 19, 2026
@wing328
Just out of the top of my head it should be:
shouldn't it? 😄
in v2.32.0
proxy-agent@6.5.0exports the constructor directly, so new ProxyAgent() succeeds and the agent is createdwing328 commentedon May 19, 2026
yes, that's what i did before but the job failed (couldn't find proxy-agent even thought it's defined in package.json, yarn.lock) and that's why i took the suggestion from co-pilot but it turns out it won't work during runtime.
please have a look at the latest change in https://github.com/OpenAPITools/openapi-generator-cli/pull/1206/changes
wing328 commentedon May 20, 2026
merged the fix (after some more tests) and released https://github.com/OpenAPITools/openapi-generator-cli/releases/tag/v2.34.0
can you please give it a try ?
bux commentedon May 21, 2026
@wing328 Successfully tested locally. Thank you!