Skip to content

Fix missing fetchWithAuth import in http-client.ts (runtime ReferenceError) - #750

Merged
Jambox11 merged 3 commits into
mux-labs:stagingfrom
proverbs31ziggo-a11y:staging
Aug 31, 2026
Merged

Fix missing fetchWithAuth import in http-client.ts (runtime ReferenceError)#750
Jambox11 merged 3 commits into
mux-labs:stagingfrom
proverbs31ziggo-a11y:staging

Conversation

@proverbs31ziggo-a11y

Copy link
Copy Markdown

Closes #660
Closes #661
Closes #662
Closes #663

Summary

fetchJson in src/lib/http-client.ts called fetchWithAuth without importing it — a guaranteed ReferenceError at runtime whenever the HTTP client is used. Without this fix, the Mux developer dashboard could silently fall back to mock wallets, fake analytics, and unauthenticated sessions in production.

Changes

  • src/lib/http-client.ts — add the missing import { fetchWithAuth } from "@/utils/fetchWithAuth".
  • src/lib/__tests__/httpClient.test.ts (new) — regression tests covering fetchJson's three paths:
    • success: parses JSON, requests with cache: "no-store"
    • non-OK response: mapped to an HTTP {status}: {body} error string
    • thrown fetch failure: mapped to the error message string

Verification

  • Failing test written first (confirmed ReferenceError before the fix, per TDD)
  • After the fix: 3/3 tests pass
  • Related auth/env tests (29 tests) still pass
  • pnpm typecheck shows no new errors in http-client.ts (remaining 22 errors are pre-existing in unrelated files: WalletDetail.tsx, AuthContext.tsx, env.ts, middleware.ts)

Why it matters

Without this import, any fetchJson call (wallet list, spending limits, transactions) crashed at runtime — pushing the dashboard toward mock data and unauthenticated sessions in production instead of the real backend.

🤖 Generated with Codebuff

proverbs31ziggo-a11y and others added 3 commits August 31, 2026 13:57
fetchJson called fetchWithAuth without importing it, so any call
raised a ReferenceError at runtime. Without this, the Mux developer
dashboard could fall back to mock wallets, fake analytics, and
unauthenticated sessions in production. Adds the missing import and
a regression test covering fetchJson's success, non-OK, and thrown
fetch-failure paths.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Complements the fetchWithAuth import fix: covers success path with
cache: no-store, non-OK response mapping, and thrown fetch failures.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
…ng-fetchWithAuth-import

Fix missing fetchWithAuth import in http-client.ts (runtime ReferenceError)
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@proverbs31ziggo-a11y Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Jambox11
Jambox11 merged commit 2d77090 into mux-labs:staging Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants