Repository navigation
Surface sign-in failures instead of failing silently - #89
Merged
Merged
Conversation
signIn() throws on failure (broker rejects the callback origin, popup blocked, etc.), and the login button's onClick never caught it -- an unhandled promise rejection that reads as "the button does nothing" with no feedback at all. Now shown as a toast. Most likely trigger: the auth broker only recognizes a fixed set of redirect origins, so sign-in fails this way on any ad-hoc preview URL (e.g. a Vercel branch preview) that isn't on that allowlist -- this doesn't fix that allowlist gap, it just makes the failure visible instead of silent.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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
Found while testing the Mechanic v3 preview (#88): clicking "Continue with Google" on
/logindid nothing visible.routes/login.tsx's button calledsignIn(p.providerId, ...)with no.catch().signIn()(inlib/auth/client.ts)throws on failure — e.g. whenauthClient.signIn.oauth2()errors — and with no handler that becomes a silent unhandled promise rejection. From the user's side that's indistinguishable from a dead button.Most likely real-world trigger: the app federates sign-in through a shared auth broker that only recognizes a fixed set of registered redirect origins. An ad-hoc preview URL (a Vercel branch preview, in this case) isn't on that list, so the broker rejects the callback and
signIn()throws — silently, until now.Change
routes/login.tsx: the click handler now catches the rejection and shows it viatoast.error(...)(Sonner is already mounted at root in__root.tsx, so no new dependency). This does not fix the underlying broker-allowlist gap — sign-in on an arbitrary preview URL will still fail — it just makes the failure visible instead of silent, on every origin.Verification
Run from
ui-v2/:npm run typecheck✅npm test✅ (28 pass)npm run build:box✅npm run lint✅ (1 pre-existing, unrelated warning indrops.test.ts)No services restarted, nothing merged.
🤖 Generated with Claude Code
https://claude.ai/code/session_01PESvczRwpL58x1u2fepPFM
Generated by Claude Code