[PR #7825] [MERGED] fix(organization): remove unreachable null check in acceptInvitation #7575

Closed
opened 2026-03-13 13:42:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7825
Author: @Saurav3004
Created: 2/6/2026
Status: Merged
Merged: 2/12/2026
Merged by: @himself65

Base: canaryHead: bugfix/issue-7824


📝 Commits (4)

  • 5e7de4e Fix acceptInvitation nullable return by throwing error (closes #7824)
  • 69240df Add missing semicolon
  • a6223ee fix: remove unreachable null check in acceptInvitation
  • 6d00164 Merge branch 'canary' into bugfix/issue-7824

📊 Changes

2 files changed (+0 additions, -7 deletions)

View changed files

📝 packages/better-auth/src/plugins/organization/organization.test.ts (+0 -1)
📝 packages/better-auth/src/plugins/organization/routes/crud-invites.ts (+0 -6)

📄 Description

Description

The acceptInvitation handler returned ctx.json(null) in an error case, causing the return type to be inferred as nullable.

This PR replaces the null response with a thrown error to ensure correct type inference and consistent error handling.

Closes #7824


Summary by cubic

Replaced the null response in acceptInvitation with a thrown BAD_REQUEST error to ensure a non-nullable result, removed the unreachable null check, and updated tests accordingly (closes #7824).

Written for commit 6d001649e4. Summary will update on new commits.


🔄 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/7825 **Author:** [@Saurav3004](https://github.com/Saurav3004) **Created:** 2/6/2026 **Status:** ✅ Merged **Merged:** 2/12/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `bugfix/issue-7824` --- ### 📝 Commits (4) - [`5e7de4e`](https://github.com/better-auth/better-auth/commit/5e7de4ecb0680476ac6501c62c9ff815ab0a43dc) Fix acceptInvitation nullable return by throwing error (closes #7824) - [`69240df`](https://github.com/better-auth/better-auth/commit/69240dfe87e7723b703c9ee7497500762b67b256) Add missing semicolon - [`a6223ee`](https://github.com/better-auth/better-auth/commit/a6223ee052aff23affe7938a25168e125d2ed96c) fix: remove unreachable null check in acceptInvitation - [`6d00164`](https://github.com/better-auth/better-auth/commit/6d001649e415d90aea15b66620227241f890a78b) Merge branch 'canary' into bugfix/issue-7824 ### 📊 Changes **2 files changed** (+0 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/organization/organization.test.ts` (+0 -1) 📝 `packages/better-auth/src/plugins/organization/routes/crud-invites.ts` (+0 -6) </details> ### 📄 Description ## Description The `acceptInvitation` handler returned `ctx.json(null)` in an error case, causing the return type to be inferred as nullable. This PR replaces the null response with a thrown error to ensure correct type inference and consistent error handling. ## Related Issue Closes #7824 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Replaced the null response in acceptInvitation with a thrown BAD_REQUEST error to ensure a non-nullable result, removed the unreachable null check, and updated tests accordingly (closes #7824). <sup>Written for commit 6d001649e415d90aea15b66620227241f890a78b. Summary will update on new commits.</sup> <!-- 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 13:42:01 -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#7575