fix: auth/sync creates user on first login, fix 500 on profile update#16
Merged
bryanfawcett merged 2 commits intomainfrom Mar 24, 2026
Merged
fix: auth/sync creates user on first login, fix 500 on profile update#16bryanfawcett merged 2 commits intomainfrom
bryanfawcett merged 2 commits intomainfrom
Conversation
New users were getting a 500 on PATCH /api/auth/profile because auth/sync returned a stub without creating a DB record, then the profile endpoint tried to INSERT with empty email hitting the UNIQUE NOT NULL constraint. Fix: auth/sync now always creates the user row on first login so the profile PATCH only needs to UPDATE (never INSERT). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
mukoko-nhimbe-api | 4ceb486 | Mar 24 2026, 07:33 AM |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…rofile test - Fix prefer-const lint error in auth.ts (userId is never reassigned) - Update auth-profile test to expect 404 when user not found (INSERT removed, user must exist via auth/sync before profile PATCH) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bryanfawcett
pushed a commit
that referenced
this pull request
Apr 9, 2026
#16: FilterBar scroll affordance - edge fade gradients that appear when content overflows left/right (ResizeObserver + scroll listener) #17: Search result images use lazy loading (img loading="lazy" instead of inline background-url CSS) #32: FAQ open state persisted to localStorage, restored on page load #35: Signage auto-refresh pause/resume toggle button (pause/play icons) #36: Calendar month/year quick-select dropdowns replace plain heading #37: Admin pagination page number buttons (up to 5 visible pages with sliding window) for both events and users tables #38: Admin sidebar shows all nav items - inaccessible ones greyed out with lock icon and "Requires X role" tooltip instead of hidden #39: Cmd+K / Ctrl+K keyboard shortcut navigates to /search from anywhere https://claude.ai/code/session_01GBDmHPeMz4FCeN4fn5Ujnx
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
auth/syncnow creates the user DB record immediately on first login instead of returning a stub. This was causing a 500 onPATCH /api/auth/profilebecause the INSERT tried to use an empty email string, hitting theUNIQUE NOT NULLconstraint.PATCH /api/auth/profilenow only does UPDATE (no INSERT fallback) — if no user is found it returns a clear 404 instead of a silent 500.STYTCH_PROJECT_IDto the correctproject-live-86090362-...value (previous fix incorrectly derived the project ID from the public token UUID, which are separate identifiers in Stytch).[nhimbe]console error logging to auth flows so JWT failures are visible in browser DevTools.location-promptsendingaddress_locality/address_countryinstead ofcity/countrythat the backend reads.Test plan
auth/synccreates user row → no 500PATCH /api/auth/profileupdates the row → no 500events-api.mukoko.comdeployed with all fixes🤖 Generated with Claude Code