Proxy support is broken #3115
Labels
area: configuration
good first issue
status: confirmed
type: bug
code to address defects in shipped code
Describe the bug
Proxy support was introduced in #1215, but it is currently broken.
To Reproduce
Steps to reproduce the behavior:
/etc/hosts
and pointing api.netlify.com to a local container / VM where we spin up a trivial HTTP server that simply stalls on any incoming request.HTTP_PROXY=http://localhost:8888 netlify login
.At this point
netlify-cli
would simply stall, and if you monitor the proxy server you'll notice that no request is going through it.Configuration
N/A.
Expected behavior
Any network request originating from netlify-cli should be proxied.
CLI Output
N/A.
Additional context
This happens because
getConfig
happens before the proxy is even configured (withgetAgent
)cli/src/utils/command.js
Lines 46 to 57 in 7a55e98
getConfig
callsresolveConfig
which is@netlify/config
.cli/src/utils/command.js
Line 4 in 7a55e98
Looking at
@netlify/config
'sresolveConfig
: https://github.com/netlify/build/blob/6813d73a21a6c4a6b99576c5b7bc60fae5d8bac4/packages/config/src/main.js#L32-L36 we see that there are API requests made at this stage unlessoffline
is true. These requests obviously aren't going through the proxy.I guess to actually fully support proxies you need to add proxy support to
@netlify/config
as well.Knowing the cause of the issue, here's a risky workaround btw: just set
offline
to true insrc/utils/command.js
:One can hot edit this directly into
node_modules/netlify-cli/src/utils/command.js
. (Don't complain to me if anything breaks, obviously.)Related: I believe #2016 is exactly this problem.
The text was updated successfully, but these errors were encountered: