Skip to content

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

Draft
dhensby wants to merge 1 commit into
tediousjs:masterfrom
dhensby:fix/cu-page-proxy
Draft

dhensby wants to merge 1 commit 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. Behind a proxy, the downloads worked, the page fetch failed, and the action installed SQL Server without the cumulative update, with only a warning.

  • Proxy. The page fetch uses @actions/http-client again, like the downloads. When a proxy applies, the action says so in the log. 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. A new README section describes this: 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.
  • Body read. 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 the response stream instead, which then fails, and limits the body to 30 seconds. The failure then goes to the normal retry and warning.
  • Fallback after a 403. 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. That block is gone: a probe from windows-2022 and windows-2025 runners on 21 November got a 200 from @actions/http-client 4.0.1 on all four update pages. In case it comes back, when the page request gets a 403 and no proxy applies, the action tries the page once with fetch in the same attempt. It doesn't try fetch through a proxy, because fetch doesn't use it.
  • Retries. Every failed request is now retried. The attempts and delays are the same as before.
  • Tests. The unit tests mock @actions/http-client, with responses that are real streams. 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, and a connection that closes before the end of the page.

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. This PR uses one HTTP client for the page and the downloads instead.

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

🤖 Generated with Claude Code

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