Skip to content

List supabase users instead of hardcoding uuid#71

Merged
kalilsn merged 1 commit into
mainfrom
kalilsn/fix-seeding
Sep 7, 2023
Merged

List supabase users instead of hardcoding uuid#71
kalilsn merged 1 commit into
mainfrom
kalilsn/fix-seeding

Conversation

@kalilsn
Copy link
Copy Markdown
Contributor

@kalilsn kalilsn commented Sep 7, 2023

This fixes login, which was failing because the UUID of our sole supabase auth user didn't match the UUID in the postgres database. I had hardcoded that value in the seed script previously, but the supabase auth user was deleted and recreated (not by the script) which gave it a new UUID.

To fix, instead of looking up the user by hardcoded id, we list all supabase users and just take the first one. This won't work once we have multiple users! But I'm not sure a better way at the moment because supabase doesn't let you look up users by email.

@render
Copy link
Copy Markdown

render Bot commented Sep 7, 2023

@isTravis isTravis temporarily deployed to kalilsn/fix-seeding - integration-submissions PR #71 September 7, 2023 17:18 — with Render Destroyed
@isTravis isTravis temporarily deployed to kalilsn/fix-seeding - integration-evaluations PR #71 September 7, 2023 17:18 — with Render Destroyed
@kalilsn kalilsn merged commit 901b024 into main Sep 7, 2023
@kalilsn kalilsn deleted the kalilsn/fix-seeding branch September 7, 2023 17:39
@gabestein
Copy link
Copy Markdown
Member

gabestein commented Sep 7, 2023

If I understand correctly, I think you could query the user by email via prisma, since we're duplicating supabase auth users in the public.auth.

Nm, I see. I think the right way to do this is to setup a trigger that automatically creates the user in public.auth. That's what supabase, etc., recommend, and I'm not sure why we're only doing an update trigger. I'll add this next week.

@isTravis
Copy link
Copy Markdown
Member

isTravis commented Sep 8, 2023

A bit of discussion about why we don't have a trigger on user creation is here and under the pages/api/user description bullet in this PR.

@gabestein
Copy link
Copy Markdown
Member

gabestein commented Sep 8, 2023 via email

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.

4 participants