-
-
Notifications
You must be signed in to change notification settings - Fork 507
⬆️ Upgrade better-auth #2316
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
Merged
+213
−96
Merged
⬆️ Upgrade better-auth #2316
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: lukevella/rallly
Length of output: 1162
🏁 Script executed:
rg "customSyntheticUser" --type ts --type tsxRepository: lukevella/rallly
Length of output: 87
🏁 Script executed:
rg "Better Auth" --type ts --type tsx -iRepository: lukevella/rallly
Length of output: 87
🏁 Script executed:
fd "auth" apps/web/src --type fRepository: lukevella/rallly
Length of output: 274
🏁 Script executed:
cat -n apps/web/src/lib/auth.ts | head -200Repository: lukevella/rallly
Length of output: 7882
🏁 Script executed:
rg "admin" apps/web/src/lib/auth.ts -i -A 3 -B 3Repository: lukevella/rallly
Length of output: 499
🏁 Script executed:
rg "schema\|Schema" apps/web/src/lib/auth.ts -A 3 -B 1Repository: lukevella/rallly
Length of output: 42
🏁 Script executed:
rg "user.*extend\|extend.*user" apps/web/src -iRepository: lukevella/rallly
Length of output: 42
🏁 Script executed:
cat -n apps/web/src/lib/auth.ts | tail -100Repository: lukevella/rallly
Length of output: 3291
🏁 Script executed:
grep -n "customSyntheticUser" apps/web/src/lib/auth.tsRepository: lukevella/rallly
Length of output: 42
🏁 Script executed:
Repository: lukevella/rallly
Length of output: 1620
🌐 Web query:
Better Auth customSyntheticUser admin plugin requireEmailVerification💡 Result:
When you enable email enumeration protection—which happens if
emailAndPassword.requireEmailVerification: true(orautoSignIn: false)—Better Auth may return a synthetic (fake) user shape on sign-up. If you’re using the admin plugin, you must extend that synthetic user to include the admin plugin’s added user fields (role,banned,banReason,banExpires), otherwise you’ll hit missing-field/type/schema issues. [1]customSyntheticUseris specifically intended for this case (“Use when plugins add fields to the user table”). [2]Sources: [1] [2]
🌐 Web query:
Better Auth 1.5 enumeration-safe sign-up customSyntheticUser💡 Result:
In Better Auth v1.5, when you enable email enumeration protection (e.g.
requireEmailVerification: trueorautoSignIn: false), the sign-up endpoint may return a synthetic (fake) user response so the client can’t tell whether an email already exists. If you use plugins that add columns touser, you must usecustomSyntheticUserto include those plugin fields in the synthetic response (otherwise you’ll get missing-field/type/runtime issues). [1][2]Example (Admin plugin adds
role,banned,banReason,banExpires): [1]If you have other plugins/custom fields, add their user-table fields into
customSyntheticUserthe same way (so the synthetic response matches your user schema). [2]Add
customSyntheticUserto theemailAndPasswordblock.With
requireEmailVerification: trueenabled and theadminplugin active, Better Auth returns a synthetic user on sign-up to prevent email enumeration. You must includecustomSyntheticUserto populate the admin plugin's fields (role,banned,banReason,banExpires) plus your customadditionalFields(timeZone,locale) in the synthetic response. Without it, the synthetic user will be missing these fields, causing schema mismatches and potential runtime errors.Example fix:
🤖 Prompt for AI Agents