[PR #4813] [CLOSED] fix: prevent TypeError when errorWithStack is undefined in to-auth-en… #5589

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4813
Author: @NalinDalal
Created: 9/22/2025
Status: Closed

Base: canaryHead: canary


📝 Commits (10+)

  • cc44e21 fix: prevent TypeError when errorWithStack is undefined in to-auth-endpoints
  • d1fe109 Revert "chore: bump tailwindcss to v4 (#4681)"
  • 1e86e4c refactor: remove unused generics (#4691)
  • 62b5069 fix(api-key): cascade api keys on user deletion (#4703)
  • 578a64e fix: device authorization plugin (#4695)
  • adfc484 fix(organization): decouple client and server permission checks (#4707)
  • fd29b5b fix: reduce any type in generator.ts (#4710)
  • bb5513d Reapply "chore: bump tailwindcss to v4 (#4681)"
  • c335407 fix: refresh secondary storage sessions on user update (#4522)
  • c6e5dab fix(adapter): returning null as string for optional id references (#4713)

📊 Changes

3 files changed (+74 additions, -39 deletions)

View changed files

📝 packages/better-auth/src/api/routes/email-verification.test.ts (+59 -0)
📝 packages/better-auth/src/api/to-auth-endpoints.ts (+14 -36)
📝 packages/better-auth/src/db/internal-adapter.ts (+1 -3)

📄 Description

…dpoints


Summary by cubic

Fixes a crash in to-auth-endpoints when debug logging tried to read errorWithStack.stack on APIError. We now guard access with optional chaining so TypeError no longer occurs when errorWithStack is missing.

  • Bug Fixes
    • Safely access errorWithStack?.stack in endpoint execution and before/after hooks.
    • Preserves stack logging when available; otherwise proceeds without a stack. No API or response changes.

🔄 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/4813 **Author:** [@NalinDalal](https://github.com/NalinDalal) **Created:** 9/22/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `canary` --- ### 📝 Commits (10+) - [`cc44e21`](https://github.com/better-auth/better-auth/commit/cc44e21da259e526948e029fbe89e30623a11f9a) fix: prevent TypeError when errorWithStack is undefined in to-auth-endpoints - [`d1fe109`](https://github.com/better-auth/better-auth/commit/d1fe10962079c82920ea078a9847f65a59907b81) Revert "chore: bump tailwindcss to v4 (#4681)" - [`1e86e4c`](https://github.com/better-auth/better-auth/commit/1e86e4c138235fe6539e2795d0fd8a9f511b4716) refactor: remove unused generics (#4691) - [`62b5069`](https://github.com/better-auth/better-auth/commit/62b50691b1db7396241aaacf6a6501c09c97e1b6) fix(api-key): cascade api keys on user deletion (#4703) - [`578a64e`](https://github.com/better-auth/better-auth/commit/578a64eb965da77254c14a676128812df4646d83) fix: device authorization plugin (#4695) - [`adfc484`](https://github.com/better-auth/better-auth/commit/adfc484fcd9dce4976a649795a7915bcd9f116a0) fix(organization): decouple client and server permission checks (#4707) - [`fd29b5b`](https://github.com/better-auth/better-auth/commit/fd29b5bd19f3dd8ee46c7615a5a581efc18fe1cc) fix: reduce any type in generator.ts (#4710) - [`bb5513d`](https://github.com/better-auth/better-auth/commit/bb5513d216b996206d9e21b21cdee20f4d98fd60) Reapply "chore: bump tailwindcss to v4 (#4681)" - [`c335407`](https://github.com/better-auth/better-auth/commit/c33540765860569a016574cb9e9cdc74f0ecfec5) fix: refresh secondary storage sessions on user update (#4522) - [`c6e5dab`](https://github.com/better-auth/better-auth/commit/c6e5dab8ab40386ac033e15e2695832105f66edf) fix(adapter): returning null as string for optional id references (#4713) ### 📊 Changes **3 files changed** (+74 additions, -39 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/email-verification.test.ts` (+59 -0) 📝 `packages/better-auth/src/api/to-auth-endpoints.ts` (+14 -36) 📝 `packages/better-auth/src/db/internal-adapter.ts` (+1 -3) </details> ### 📄 Description …dpoints <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes a crash in to-auth-endpoints when debug logging tried to read errorWithStack.stack on APIError. We now guard access with optional chaining so TypeError no longer occurs when errorWithStack is missing. - **Bug Fixes** - Safely access errorWithStack?.stack in endpoint execution and before/after hooks. - Preserves stack logging when available; otherwise proceeds without a stack. No API or response changes. <!-- 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:28:42 -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#5589