-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Expected Behaviour
Console commands use the proxy set via the environment variables HTTP_PROXY and/or HTTPS_PROXY.
Actual Behaviour
Console commands do not use the proxy set via the environment variables HTTP_PROXY and/or HTTPS_PROXY.
Reproduce Scenario (including but not limited to)
- Run a proxy locally, use the proxy code at mitmproxy.org.
- For your App Builder project, set the env vars
HTTP_PROXYandHTTPS_PROXYtohttp://127.0.0.1:8080andhttps://127.0.0.1:8080respectively - Verify that the proxy settings are set via running
aio info - Run
aio console org list- it should hit the proxy, but it does not (see logs in the Terminal)
Investigation
The library that we use @adobe/aio-lib-console, uses the swagger-client npm library, which uses the default fetch capability in node.js >=18. Node does not respect the HTTP_PROXY and HTTPS_PROXY environment variables, it has to be handled in the client library itself, and the library does not do it directly.
Proposed Fix
The swagger-client library has a capability to set your own fetch implementation via a userFetch property - we could use the proxied fetch implementation in @adobe/aio-lib-core-networking in aio-lib-console.
Workaround
There is no true workaround since node.js does not use system proxy settings (so you can't set it there).
The only way for the command to work is to not use the proxy.