Conversation
`pnpm publish` uses `libnpmpublish` for the initial request (which routes through the configured HTTP/HTTPS proxy), but the `doneUrl` polling that completes the web-based authentication flow used `@pnpm/network.fetch` without forwarding the proxy/TLS settings. The registry rejected the poll with `403` because the source IP did not match the initial request, leaving publish stuck on the QR code prompt forever. Build a `DispatcherOptions` from the publish opts (proxy, no-proxy, TLS, local-address, client certs) and route the polling request through `fetchWithDispatcher` so it uses the same network configuration as the publish request. Fixes #11561.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🧰 Additional context used📓 Path-based instructions (2)**/*.{js,ts,tsx,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.test.{js,ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🔇 Additional comments (1)
📝 WalkthroughWalkthroughThis PR fixes web-based OTP authentication polling in ChangesProxy-aware OTP polling
Sequence Diagram(s)sequenceDiagram
participant CLI as publishPackedPkg
participant CreateDisp as createDispatchedFetch
participant OtpHandler as publishWithOtpHandling
participant Registry as registry(doneUrl)
CLI->>CreateDisp: provide proxy/TLS/localAddress/timeout/options
CreateDisp-->>CLI: dispatcher-bound fetch function
CLI->>OtpHandler: call publishWithOtpHandling with OtpContext.fetch (dispatcher-bound)
OtpHandler->>Registry: poll doneUrl using OtpContext.fetch (proxy/TLS honored)
Registry-->>OtpHandler: auth status (success/failure)
OtpHandler-->>CLI: publish result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Fixes pnpm publish hanging during the web-based OTP flow when a proxy is configured by ensuring the registry doneUrl polling request uses the same proxy/TLS/local-address settings as the initial publish request.
Changes:
- Plumbs publish network settings into
doneUrlpolling via@pnpm/network.fetch’sfetchWithDispatcher. - Exports
extractTlsConfigsfrom@pnpm/network.fetchto reuse existing TLS config extraction logic. - Adds a unit test asserting
doneUrlpolling is routed throughfetchWithDispatcherwhen dispatcher options are provided.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| releasing/commands/test/publish/otp-proxy.test.ts | Adds a unit test that mocks fetchWithDispatcher and asserts proxy-aware polling is used. |
| releasing/commands/src/publish/publishPackedPkg.ts | Builds DispatcherOptions from publish/config options and passes them into OTP handling. |
| releasing/commands/src/publish/otp.ts | Wraps the web-auth polling fetch to use fetchWithDispatcher when dispatcher options are supplied. |
| network/fetch/src/index.ts | Re-exports extractTlsConfigs from the package entrypoint. |
| network/fetch/src/fetchFromRegistry.ts | Promotes extractTlsConfigs from file-private to exported API. |
| .changeset/fix-11561-publish-web-auth-proxy.md | Adds a changeset describing the publish proxy fix (but currently missing @pnpm/network.fetch bump). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…Options from otp API `publishWithOtpHandling` no longer needs to know about dispatcher options. Instead, `publishPackedPkg` constructs an `OtpContext` whose `fetch` is already bound to the right dispatcher options (proxy/TLS/etc.) via the new `createDispatchedFetch` helper in `@pnpm/network.fetch`. This keeps the OTP flow purely about OTP and consolidates network wiring at the call site where the publish config lives. The unit test moves to `@pnpm/network.fetch` where it covers the new helper, replacing the proxy-specific test in releasing.commands.
`createDispatchedFetch` now accepts `configByUri` directly and runs `extractTlsConfigs` internally, so callers no longer need to do it themselves. `extractTlsConfigs` reverts to a file-private helper, and the publish callsite drops `buildDispatcherOptions` entirely. `createFetchFromRegistry` also stops re-extracting on every request — the result is computed once at factory time, since `configByUri` is fixed.
Extract the OtpContext construction from publishPackedPkg into a small exported helper, then unit-test that it forwards proxy / TLS / local- address settings (and translates fetchTimeout -> timeout) to createDispatchedFetch. This is the wiring asserted by #11561.
Summary
pnpm publishfailed to complete the web-based authentication flow when an HTTP/HTTPS proxy was configured.libnpmpublish(used for the initial publish request) routes through the proxy, but the subsequentdoneUrlpolling went through@pnpm/network.fetchwithout forwarding any proxy/TLS settings. The registry rejected the poll with403because the source IP differed from the initial request, so publish hung on the QR-code prompt forever.createDispatchedFetch(opts)to@pnpm/network.fetch— a curriedfetchWithDispatcherthat pre-binds proxy / TLS / local-address /configByUri-derived client certificates.publishPackedPkguses it to build anOtpContextwhosefetchhonors the same network configuration as the publish request.extractTlsConfigsis now performed automatically insidecreateDispatchedFetch(and hoisted out of the per-request loop increateFetchFromRegistry), so callers only have to passconfigByUrionce.Fixes #11561.
Test plan
releasing/commands/test/publish/createPublishContext.test.ts) — asserts that the publish-side helper forwardshttpProxy/httpsProxy/noProxy/localAddress/strictSsl/ca/cert/key/configByUritocreateDispatchedFetch, thatfetchTimeoutis translated totimeout, and that the resultingcontext.fetchis the dispatched fetch.network/fetch/test/fetchFromRegistry.test.ts) — covers the newcreateDispatchedFetchhelper end-to-end against a MockAgent.releasing/commands/test/publish/otp.test.ts, 14 tests).@pnpm/network.fetchtest suite passes (37 tests).pnpm run lintclean (only pre-existingjest/no-disabled-testswarnings).Written by an agent (Claude Code, claude-opus-4-7).
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests