Skip to content

fix(auth): stop the after-hook from clobbering every response with null - #422

Merged
chriss1525 merged 1 commit into
mainfrom
chore/pin-better-auth-1.6.15
Jun 24, 2026
Merged

chriss1525 merged 1 commit into
mainfrom
chore/pin-better-auth-1.6.15

Conversation

@chriss1525

Copy link
Copy Markdown
Contributor

better-auth's dispatcher only treats a hook's response as an override when it is !== undefined (better-auth/dist/api/dispatch.mjs) -- null counts as a real override, not a no-op. This hook only has side effects to run (JIT provisioning on sign-up) and returned { response: null, headers: null } for every other path as its "nothing to do" signal, which wiped the real response of every other better-auth endpoint -- including /sign-in/email and /get-session -- to literal null.

Fix: return nothing instead of { response: null } for the no-op paths, leaving the dispatcher's original response untouched.

Summary

Related issues

How to test

Checklist

  • I have run and reviewed this code locally.
  • pnpm typecheck passes.
  • pnpm lint passes.
  • Tests added or updated where applicable, and pnpm test passes.
  • Database migrations included if the schema changed.
  • Screenshots or recordings attached for UI changes.
  • PR title follows the conventional-commit style and reads as a release note.

better-auth's dispatcher only treats a hook's `response` as an override
when it is `!== undefined` (better-auth/dist/api/dispatch.mjs) -- `null`
counts as a real override, not a no-op. This hook only has side effects
to run (JIT provisioning on sign-up) and returned `{ response: null,
headers: null }` for every other path as its "nothing to do" signal,
which wiped the real response of every other better-auth endpoint --
including /sign-in/email and /get-session -- to literal null.

Fix: return nothing instead of `{ response: null }` for the no-op
paths, leaving the dispatcher's original response untouched.
@chriss1525
chriss1525 requested a review from koolamusic as a code owner June 24, 2026 16:10
@chriss1525
chriss1525 merged commit 061775c into main Jun 24, 2026
4 checks passed
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