fix(market): 404 JSON for unknown API routes + OAuth ops runbook - #1874
Merged
Conversation
…OAuth setup Unmatched /miniapp/api/v1/* paths used to fall through to the SPA's index.html (200 + HTML) because axum flattens nested routers and the outer catch-all won. Register an explicit wildcard inside the API router so unknown routes get the versioned error envelope. Also add an operations subsection to the deploy runbook covering GitHub OAuth App setup: no management API exists, secrets display only once, reuse-and-rotate guidance, read-only verification via health and /auth/github/start, and the SPA-fallback debugging pitfall.
bobleer
marked this pull request as ready for review
July 30, 2026 04:30
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.
Summary
Distills what we learned configuring GitHub OAuth on the production market server (2026-07-29/30) back into the repo.
Code —
src/crates/services/miniapp-market-service:/miniapp/api/v1/*paths used to fall through to the SPA and return200+index.html, which made API debugging genuinely confusing (a typoed auth path looks like a live endpoint). Because axum flattens nested routers, a nested.fallback()loses to the outer/miniapp/{*rest}catch-all — so this registers an explicit/{*rest}wildcard inside the API router instead. Unknown API routes now return the standard versioned 404 JSON envelope.health_route_boots_with_an_empty_databasenow also asserts the 404 envelope).Docs —
deploy/miniapp-market/README.md:health→githubAuthConfigured:true,/auth/github/start→ 307 to GitHub with matching client_id/redirect_uri).Testing
cargo test -p bitfun-miniapp-market-service— 19 passedcargo check -p bitfun-miniapp-market-server— cleancargo fmt --check— clean