We are developing Azure DevOps extension with pipeline tasks. We are using typescript/node/npm packages as technologies in this. One of these pipeline task’s responsibilities is gathering data from external source with aid from embedded API wrapper and create work items based on gathered/composed data.
High level architecture of the task is as below
We are trying to support users who uses proxies by passing https_proxy variable to the wrapper (wrapper is designed to accept https_proxy variable). Code is something similar to below.
import * as tlib from 'azure-pipelines-task-lib/task';
tlib.setVariable(“https_proxy”, “http://username:password@hostname:port” ,false);
With above implantation we were successfully able to access external source trough API wrapper and gather necessary data.
However, it is observed that having https_proxy in pipeline task breaks communication between pipeline task and Azure DevOps API ('azure-devops-node-api) and we are getting below error.
Error: tunneling socket could not be established, statusCode=407
We cannot identify root cause of this issue and noticed that defining https_proxy variable is configuring proxy server in Azure (Not 100% sure whether this is same to Azure DevOps as well).
https://learn.microsoft.com/en-us/dotnet/azure/sdk/azure-sdk-configure-proxy?tabs=cmd
p.s We can resolve this issue by setting no_proxy as below after consuming http_proxy for gathering data. But there is issue in this approach as this could disable all proxies. For example, let’s assume computer is config to use proxy A, but wrapper is using proxy B. with no_proxy implementation we force Azure DevOps API to use no_proxy instead of proxy A. Hence, we must think of alternative solution
process.env["NO_PROXY"] = "*";
Highly appreciate you can share any tips and suggestions to overcome this issue