Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update supabase-admin.ts createorretrievecustomer #200

Closed
wants to merge 1 commit into from

Conversation

kschmelter13
Copy link

Not sure if this is helpful, but i used it in my personal project to validate existing customers so it wont create duplicates, after an account is deleted

@vercel
Copy link

vercel bot commented Jun 4, 2023

@kschmelter13 is attempting to deploy a commit to the Vercel Solutions Team on Vercel.

A member of the Team first needs to authorize it.

@chriscarrollsmith
Copy link
Contributor

Interesting, thanks. So just to be clear, you encountered a scenario where the customer had been deleted from Supabase but not from Stripe, and this was resulting in a duplicate customer record being created in Stripe. To prevent this, you added a check for a matching record in Stripe before creating a new Stripe customer. Correct?

@chriscarrollsmith
Copy link
Contributor

It looks like your code fails if the customer already exists in both supabase and stripe, because it finds a stripe record and then tries to upsert a duplicate record to supabase without checking if a supabase record exists first, which causes a primary key conflict.

I opened a new PR here: #274

@leerob
Copy link
Member

leerob commented Feb 12, 2024

#278

@leerob leerob closed this Feb 12, 2024
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.

3 participants