[PR #4623] [MERGED] fix(organization): before org create hooks not applying customized data #5491

Closed
opened 2026-03-13 12:24:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4623
Author: @Bekacru
Created: 9/13/2025
Status: Merged
Merged: 9/13/2025
Merged by: @Bekacru

Base: canaryHead: fix/org-hooks


📝 Commits (2)

  • 962c4df fix(organization): before org create hooks not applying customized data
  • ff8eea7 chore: lint

📊 Changes

2 files changed (+9 additions, -4 deletions)

View changed files

📝 packages/better-auth/src/plugins/organization/routes/crud-org.test.ts (+2 -0)
📝 packages/better-auth/src/plugins/organization/routes/crud-org.ts (+7 -4)

📄 Description

Summary by cubic

Fixes organization creation so data returned by before-create hooks is applied. Also ensures returned metadata has the correct type.

  • Bug Fixes
    • Merge hook response into orgData (not ctx.body) so customized fields (e.g., name, metadata) persist through creation.
    • Parse metadata from JSON string when returning the organization to keep types consistent.

🔄 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/4623 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 9/13/2025 **Status:** ✅ Merged **Merged:** 9/13/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/org-hooks` --- ### 📝 Commits (2) - [`962c4df`](https://github.com/better-auth/better-auth/commit/962c4dfb2ed4cc1dd69dd8172c5246b61fe5bcfa) fix(organization): before org create hooks not applying customized data - [`ff8eea7`](https://github.com/better-auth/better-auth/commit/ff8eea75937c02146432f8be9066ec333dc3c482) chore: lint ### 📊 Changes **2 files changed** (+9 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/organization/routes/crud-org.test.ts` (+2 -0) 📝 `packages/better-auth/src/plugins/organization/routes/crud-org.ts` (+7 -4) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Fixes organization creation so data returned by before-create hooks is applied. Also ensures returned metadata has the correct type. - **Bug Fixes** - Merge hook response into orgData (not ctx.body) so customized fields (e.g., name, metadata) persist through creation. - Parse metadata from JSON string when returning the organization to keep types consistent. <!-- End of auto-generated description by cubic. --> --- <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-03-13 12:24:47 -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#5491