[PR #3418] [MERGED] fix(admin): before hook not triggering on create user #30411

Closed
opened 2026-04-17 21:30:57 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3418
Author: @Kinfe123
Created: 7/17/2025
Status: Merged
Merged: 7/17/2025
Merged by: @Bekacru

Base: mainHead: fix/ctx-pass-to-create-with-hook


📝 Commits (2)

📊 Changes

2 files changed (+12 additions, -10 deletions)

View changed files

📝 packages/better-auth/src/plugins/admin/admin.test.ts (+0 -1)
📝 packages/better-auth/src/plugins/admin/admin.ts (+12 -9)

📄 Description

Summary by cubic

Fixed an issue where the before create hook was not triggered when creating a user through the admin plugin.

  • Bug Fixes
  • Passed the context to the internal createUser call to ensure hooks run as expected.
  • Added a test to confirm the before create hook is executed on user creation.

closes #3389

now it triggers it and see the output.
Screenshot 2025-07-17 at 6 02 20 AM


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/3418 **Author:** [@Kinfe123](https://github.com/Kinfe123) **Created:** 7/17/2025 **Status:** ✅ Merged **Merged:** 7/17/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `fix/ctx-pass-to-create-with-hook` --- ### 📝 Commits (2) - [`ab543be`](https://github.com/better-auth/better-auth/commit/ab543be8ded05f59f2dc193192fc5cdc3fc37eb9) ctx pass on the create with hook - [`94ccd04`](https://github.com/better-auth/better-auth/commit/94ccd0412ffe7ff0e29dd2113dc7b30672dff618) ctx ### 📊 Changes **2 files changed** (+12 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/admin/admin.test.ts` (+0 -1) 📝 `packages/better-auth/src/plugins/admin/admin.ts` (+12 -9) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Fixed an issue where the before create hook was not triggered when creating a user through the admin plugin. - **Bug Fixes** - Passed the context to the internal createUser call to ensure hooks run as expected. - Added a test to confirm the before create hook is executed on user creation. closes #3389 <!-- End of auto-generated description by cubic. --> now it triggers it and see the output. <img width="322" height="139" alt="Screenshot 2025-07-17 at 6 02 20 AM" src="https://github.com/user-attachments/assets/c25ae909-378b-43f4-a182-43058887b4c0" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 21:30:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#30411