Fix missing fetchWithAuth import in http-client.ts (runtime ReferenceError) - #750
Merged
Merged
Conversation
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)
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #660
Closes #661
Closes #662
Closes #663
Summary
fetchJsoninsrc/lib/http-client.tscalledfetchWithAuthwithout importing it — a guaranteedReferenceErrorat 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 missingimport { fetchWithAuth } from "@/utils/fetchWithAuth".src/lib/__tests__/httpClient.test.ts(new) — regression tests coveringfetchJson's three paths:cache: "no-store"HTTP {status}: {body}error stringVerification
ReferenceErrorbefore the fix, per TDD)pnpm typecheckshows no new errors inhttp-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
fetchJsoncall (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