chore(core): use global for multiple instances of BetterAuth#7334
Merged
himself65 merged 3 commits intobetter-auth:canaryfrom Jan 13, 2026
Merged
chore(core): use global for multiple instances of BetterAuth#7334himself65 merged 3 commits intobetter-auth:canaryfrom
himself65 merged 3 commits intobetter-auth:canaryfrom
Conversation
|
@himself65 is attempting to deploy a commit to the better-auth Team on Vercel. A member of the Team first needs to authorize it. |
better-auth
@better-auth/cli
@better-auth/core
@better-auth/expo
@better-auth/oauth-provider
@better-auth/passkey
@better-auth/scim
@better-auth/sso
@better-auth/stripe
@better-auth/telemetry
commit: |
Contributor
There was a problem hiding this comment.
1 issue found across 4 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/core/src/context/global.ts">
<violation number="1" location="packages/core/src/context/global.ts:31">
P2: `epoch` is incremented the first time this module calls `getBetterAuthGlobal()` because `bind` is never set when the global object is created. The next call sees `bind` still null and increments `epoch`, so a single instance is reported as two. Assign `bind` during initialization so the counter only increments when a separate module copy loads.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
himself65
added a commit
to himself65/better-auth
that referenced
this pull request
Jan 13, 2026
…auth#7334) Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
himself65
added a commit
that referenced
this pull request
Jan 14, 2026
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
himself65
added a commit
that referenced
this pull request
Jan 15, 2026
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
himself65
added a commit
that referenced
this pull request
Jan 28, 2026
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
rae-fcm
pushed a commit
to FullCodeMedical/better-auth
that referenced
this pull request
Mar 9, 2026
…auth#7334) Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Contributor
|
This pull request has been locked as it was closed more than 7 days ago. If these changes are still relevant or you have additional context, please open a new PR and reference this one. |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes: #7023 (comment)
Summary by cubic
Share AsyncLocalStorage via a process-global BetterAuth registry so multiple BetterAuth instances in the same process use the same contexts. Fixes context/transaction issues caused by duplicate packages under SSR/bundlers.
Written for commit 481e472. Summary will update on new commits.