Follow-up to #133: that PR fixed the desktop download route, but BIT-31961 reopened with the same ERRSIG a week later. Root cause: the hub fingerprints a bare TypeError: fetch failed (no file/line, since native undici errors carry no frame pointing into our code) by component + message shape only — any unwrapped fetch/fetchImpl call site in apps/api collapses into this one indistinguishable signature, so fixing one call site doesn't stop a different one from reopening the same ticket.
Audited every remaining fetch/fetchImpl call site in apps/api/src against this exact message. Two were still bare: shop/stripe.ts's createCheckout() (Checkout Sessions) and call() (Connect: accountLink/accountReady/createConnectedAccount/createTransfer), and invoicing/invoicexpress.ts's call(). Everything else (zerozero, Nextcloud/archive CloudClient, VIES, calendar ICS download()) already wraps network failures into a descriptive domain error.
Wraps both in try/catch, rethrowing StripeError/InvoicingError (status 0, descriptive message) on network failure — same shape the rest of the codebase already uses. Future occurrences get their own frame/fingerprint instead of colliding into this ticket, and callers that already catch StripeError/InvoicingError (e.g. EarningsService.transfer, InvoicingWorker) degrade gracefully instead of leaking a raw 500.
Test plan
apps/api/test/shop.test.ts — new test asserts createCheckout() throws StripeError (not a raw TypeError) on a rejecting fetchImpl.
apps/api/test/invoicing.test.ts — new test asserts InvoiceXpress.check() throws InvoicingError on a rejecting fetchImpl.
npx vitest run test/shop.test.ts test/invoicing.test.ts test/desktop-updates.test.ts — 27/27 passing.
npx tsc --noEmit — no new errors (pre-existing unrelated errors from stale packages/contracts/packages/metadata build output vs. an already-merged main commit; confirmed present on a clean origin/main checkout without this diff).
## Summary
- Follow-up to #133: that PR fixed the desktop download route, but BIT-31961 reopened with the same ERRSIG a week later. Root cause: the hub fingerprints a bare `TypeError: fetch failed` (no file/line, since native undici errors carry no frame pointing into our code) by **component + message shape only** — any unwrapped `fetch`/`fetchImpl` call site in `apps/api` collapses into this one indistinguishable signature, so fixing one call site doesn't stop a *different* one from reopening the same ticket.
- Audited every remaining `fetch`/`fetchImpl` call site in `apps/api/src` against this exact message. Two were still bare: `shop/stripe.ts`'s `createCheckout()` (Checkout Sessions) and `call()` (Connect: `accountLink`/`accountReady`/`createConnectedAccount`/`createTransfer`), and `invoicing/invoicexpress.ts`'s `call()`. Everything else (zerozero, Nextcloud/archive `CloudClient`, VIES, calendar ICS `download()`) already wraps network failures into a descriptive domain error.
- Wraps both in try/catch, rethrowing `StripeError`/`InvoicingError` (status `0`, descriptive message) on network failure — same shape the rest of the codebase already uses. Future occurrences get their own frame/fingerprint instead of colliding into this ticket, and callers that already catch `StripeError`/`InvoicingError` (e.g. `EarningsService.transfer`, `InvoicingWorker`) degrade gracefully instead of leaking a raw 500.
## Test plan
- [x] `apps/api/test/shop.test.ts` — new test asserts `createCheckout()` throws `StripeError` (not a raw `TypeError`) on a rejecting `fetchImpl`.
- [x] `apps/api/test/invoicing.test.ts` — new test asserts `InvoiceXpress.check()` throws `InvoicingError` on a rejecting `fetchImpl`.
- [x] `npx vitest run test/shop.test.ts test/invoicing.test.ts test/desktop-updates.test.ts` — 27/27 passing.
- [x] `npx tsc --noEmit` — no new errors (pre-existing unrelated errors from stale `packages/contracts`/`packages/metadata` build output vs. an already-merged main commit; confirmed present on a clean `origin/main` checkout without this diff).
The error hub fingerprints a bare \"TypeError: fetch failed\" with no
frame (native undici errors don't point into our code) by component
and message shape alone — every unwrapped fetch call site in the same
component collapses into one indistinguishable ERRSIG. Fixing the
desktop download route (PR #133) didn't stop this ticket from
reopening, because shop/stripe.ts's createCheckout()/call() (Stripe
Checkout + Connect) and invoicing/invoicexpress.ts's call() also threw
the native fetch error straight through to callers/routes with no
wrapping, unlike every other network client in apps/api (zerozero,
Nextcloud, VIES, calendar ICS).
Wraps both call sites in try/catch and rethrows a StripeError/
InvoicingError (status 0, descriptive message) on network failure —
same pattern Nextcloud's CloudClient and calendar's download() already
use. Gives future occurrences their own frame and fingerprint instead
of colliding into this one.
Paperclip-Agent: José Alves (urlKey jos-alves; id 11179220-3cec-4f0f-880d-2771ff64fce8)
Paperclip-Issue: BIT-31961
Paperclip-Run: 36170d99-50b2-4583-ae8e-ce8cfc898189
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
TypeError: fetch failed(no file/line, since native undici errors carry no frame pointing into our code) by component + message shape only — any unwrappedfetch/fetchImplcall site inapps/apicollapses into this one indistinguishable signature, so fixing one call site doesn't stop a different one from reopening the same ticket.fetch/fetchImplcall site inapps/api/srcagainst this exact message. Two were still bare:shop/stripe.ts'screateCheckout()(Checkout Sessions) andcall()(Connect:accountLink/accountReady/createConnectedAccount/createTransfer), andinvoicing/invoicexpress.ts'scall(). Everything else (zerozero, Nextcloud/archiveCloudClient, VIES, calendar ICSdownload()) already wraps network failures into a descriptive domain error.StripeError/InvoicingError(status0, descriptive message) on network failure — same shape the rest of the codebase already uses. Future occurrences get their own frame/fingerprint instead of colliding into this ticket, and callers that already catchStripeError/InvoicingError(e.g.EarningsService.transfer,InvoicingWorker) degrade gracefully instead of leaking a raw 500.Test plan
apps/api/test/shop.test.ts— new test assertscreateCheckout()throwsStripeError(not a rawTypeError) on a rejectingfetchImpl.apps/api/test/invoicing.test.ts— new test assertsInvoiceXpress.check()throwsInvoicingErroron a rejectingfetchImpl.npx vitest run test/shop.test.ts test/invoicing.test.ts test/desktop-updates.test.ts— 27/27 passing.npx tsc --noEmit— no new errors (pre-existing unrelated errors from stalepackages/contracts/packages/metadatabuild output vs. an already-merged main commit; confirmed present on a cleanorigin/maincheckout without this diff).auto-approve: CI success on
67c1a33e47(gitea_auto_approve_open_prs_once.py)auto-approve: CI success on
67c1a33e47(gitea_auto_approve_open_prs_once.py)auto-approve: CI success on
67c1a33e47(gitea_auto_approve_open_prs_once.py)