Skip to content

fix: fetch the cumulative update page through the runner's proxy - #352

Draft
dhensby wants to merge 3 commits into
tediousjs:masterfrom
dhensby:fix/cu-page-proxy
Draft

dhensby wants to merge 3 commits into
tediousjs:masterfrom
dhensby:fix/cu-page-proxy

Conversation

@dhensby

@dhensby dhensby commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

The cumulative update page fetch used Node's fetch, which ignores HTTPS_PROXY and NO_PROXY unless NODE_USE_ENV_PROXY is set when Node starts. The installer and update downloads use @actions/http-client, which follows these settings. On a self-hosted runner that reaches the internet only through an explicit proxy, the downloads worked, the page fetch failed, and the action installed SQL Server without the cumulative update, with only a warning. GitHub-hosted runners have no proxy settings, so they weren't affected.

  • The client depends on the proxy. When the runner's proxy settings apply to the page, the action fetches it with @actions/http-client, the same client as the downloads, so it uses the proxy. Otherwise it keeps Node's fetch, exactly as before. The action says in the log when it uses a proxy, and it names the proxy host only when the proxy URL has no credentials. If the page still can't be fetched, the error says how to fetch it directly with NO_PROXY.
  • Why not @actions/http-client for every runner. The page fetch moved to fetch in fix: fetch cumulative update pages with native fetch to avoid 403s #258, because Microsoft refused every @actions/http-client request for these pages from GitHub runners with a 403 for some days in July, while it accepted fetch. It still happens: in an earlier revision of this PR, which used @actions/http-client on every runner, 3 of the 6 CI requests to the SQL Server 2025 page got a 403. In the same run, fetch got a 200 each time.
  • Through the proxy. HttpClientResponse.readBody() in @actions/http-client 4.0.1 never settles when the connection closes or stalls before the end of the body, so the step would exit with code 0 without installing SQL Server. The action reads each response as a stream instead, which then fails, with a 30-second limit for each body. It also follows redirects itself, because http-client reads redirect bodies with readBody() and can't follow a relative Location.
  • Retries. Every failed request is now retried. The attempts and delays are the same as before.
  • Docs. A new README section describes the proxy settings, and how to fetch the page directly: set NO_PROXY: www.microsoft.com on the setup-sqlserver step. Only the update pages use that host, so the downloads still go through the proxy, and a test checks that only the update pages use it.
  • Tests. The unit tests check which client the action uses in each case, including NO_PROXY values and proxy values without a scheme. A new test file fetches pages through a real CONNECT proxy on the loopback address, with no mocked HTTP. It covers a successful fetch, an https:// page through HTTPS_PROXY, a 407 from the proxy with its NO_PROXY hint, a relative redirect, and connections that close before the end of a page or a redirect.

I considered keeping fetch and passing it the proxy dispatcher from @actions/http-client. That mixes undici 6 with the undici 7 that is built into Node 24, and it breaks on Node 26, which bundles undici 8.

Part of #331. The cache key item follows in a separate PR.

🤖 Generated with Claude Code

dhensby and others added 2 commits November 21, 2026 20:45
The page fetch used Node's fetch, which ignores HTTPS_PROXY and
NO_PROXY unless NODE_USE_ENV_PROXY is set when Node starts. The
installer and update downloads use @actions/http-client, which follows
these settings. So behind a proxy, the downloads worked, the page
fetch failed, and the action installed SQL Server without the
cumulative update.

Fetch the page with @actions/http-client again. Its readBody() never
settles when the connection closes before the end of the body, so read
the response stream instead, which then fails, and limit the body to
30 seconds. Retry every failure. When a proxy applies, say so in the
log, and say in the failure reason how to fetch the page directly with
NO_PROXY. Name the proxy by its host only when its URL has no
credentials.

Microsoft has refused @actions/http-client requests for these pages
before. It sent HTTP 403 for every request from GitHub runners, but it
accepted Node's fetch from the same runners. So when the page request
gets a 403 and no proxy applies, try the page once with Node's fetch
in the same attempt.

The README describes the proxy settings. Tests fetch a page through a
real local proxy, also when the connection closes early, and a test
checks that only the update pages use www.microsoft.com, as the README
says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fix: fetch the cumulative update page through the runner's proxy

The page fetch used Node's fetch, which ignores HTTPS_PROXY and
NO_PROXY unless NODE_USE_ENV_PROXY is set when Node starts. The
installer and update downloads use @actions/http-client, which follows
these settings. So behind a proxy, the downloads worked, the page
fetch failed, and the action installed SQL Server without the
cumulative update.

When a proxy applies to the page, fetch the page with
@actions/http-client, which then uses the proxy like the downloads.
Otherwise keep Node's fetch. Microsoft has refused @actions/http-client
requests for these pages from GitHub runners with HTTP 403, and
accepted Node's fetch from the same runners.

Through the proxy, follow redirects in the action and read each body
as a stream with a 30 second limit, because the client's readBody()
never settles when the connection closes early. When a proxy applies,
say so in the log, and say in the failure reason how to fetch the page
directly with NO_PROXY. Retry every failure.

The README describes the proxy settings. Tests fetch pages through a
real local proxy, and a test checks that only the update pages use
www.microsoft.com, as the README says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant