Skip to content

Conversation

@RahulGurav82
Copy link

This PR fixes an issue where users signing up with Google OAuth were not found in MongoDB due to webhook delays.

βœ… Implemented createOrGetUser to check for existing users before creating new ones.
βœ… Updated the user.created webhook handler to use createOrGetUser instead of createUser, preventing duplicate user creation.
βœ… Modified getUserById to fetch user data from Clerk and create them if missing in MongoDB, improving resilience.
βœ… Ensured smoother user creation flow for both email/password and OAuth signups.

This resolves the "User not found" error caused by a race condition between OAuth completion and webhook delivery.

@vercel
Copy link

vercel bot commented Mar 1, 2025

@RahulGurav82 is attempting to deploy a commit to the JS Mastery Pro Team on Vercel.

A member of the Team first needs to authorize it.

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