Skip to content

fix: admin mentors page 500 on the ambiguous users embed - #89

Merged
thomgabriel merged 1 commit into
mainfrom
fix/mentorship-claimer-embed
Sep 4, 2026
Merged

fix: admin mentors page 500 on the ambiguous users embed#89
thomgabriel merged 1 commit into
mainfrom
fix/mentorship-claimer-embed

Conversation

@thomgabriel

Copy link
Copy Markdown
Collaborator

mentorship_bookings has two foreign keys to users (claimed_by and released_by), so PostgREST rejects claimer:users(full_name) with 'more than one relationship was found' and the admin mentors page fails to render. Reproduced against production with the service role; the query passes once the claimed_by constraint is named in the embed. Blocks organizers from adding mentors.

…ip bookings

mentorship_bookings references users twice (claimed_by, released_by), so PostgREST refused the ambiguous embed and the admin mentors page threw on render.
@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hackathon-platform Ready Ready Preview Sep 4, 2026 7:18pm UTC

Request Review

@claude

claude Bot commented Sep 4, 2026

Copy link
Copy Markdown

Claude finished @thomgabriel's task in 22s —— View job


Review: safe to merge

Verified against supabase/migrations/00060_mentorship.sql: claimed_by has no explicit constraint name, so Postgres auto-generates mentorship_bookings_claimed_by_fkey, matching the embed hint added in the diff. mentorship_bookings also has a released_by FK to users, which is what triggers PostgREST's "more than one relationship was found" ambiguity — naming claimed_by's constraint resolves it correctly.

Checked for other spots embedding users through mentorship_bookings (user:users(...) patterns elsewhere are all through single-FK tables like team_members/hackathon_registrations) — no other ambiguous embeds exist.

No findings.

  • Get diff and understand the change
  • Verify the FK constraint name against migrations
  • Check for other embeds of users via mentorship_bookings with the same ambiguity
  • Post findings

@thomgabriel
thomgabriel merged commit 06e5e78 into main Sep 4, 2026
4 checks passed
@thomgabriel
thomgabriel deleted the fix/mentorship-claimer-embed branch September 4, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant