adobe / adobe/aio-cli

the discover command does not use the proxy set via the env vars HTTP_PROXY, HTTPS_PROXY

Open
#637 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
95
Forks
45
PR merge metrics
No merged PRs in 30d

Description

## Expected Behaviour

The `discover` command uses the proxy set via the environment variables `HTTP_PROXY` and/or `HTTPS_PROXY`.

## Actual Behaviour

The `discover` command does not use the proxy set via the environment variables `HTTP_PROXY` and/or `HTTPS_PROXY`.

## Reproduce Scenario (including but not limited to)

1. Run a proxy locally, use the proxy code at [mitmproxy.org](https://mitmproxy.org).
2. For your App Builder project, set the env vars `HTTP_PROXY` and `HTTPS_PROXY` to `http://127.0.0.1:8080` and `https://127.0.0.1:8080` respectively
3. Verify that the proxy settings are set via running `aio info`
4. Run `aio discover` - it should hit the proxy, but it does not (see logs in the Terminal)

## Investigation

We use node-fetch directly, without setting any proxy server configuration via the environment variables.

## Proposed Fix

Use the[ proxied fetch](https://github.com/adobe/aio-lib-core-networking?tab=readme-ov-file#ProxyFetch) implementation in [@adobe/aio-lib-core-networking](https://github.com/adobe/aio-lib-core-networking) instead of node-fetch.

## 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.

Contributor guide

Open the contributing guide

Research direction

Start with the implementation of the `discover` command and trace its direct use of `node-fetch`. Read the `ProxyFetch` documentation in `@adobe/aio-lib-core-networking`, then reproduce with `HTTP_PROXY` and `HTTPS_PROXY` set as described. Done means `aio discover` sends requests through the configured proxy.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.