[PR #2699] [MERGED] update(trustedOrigin): Warn if invalid value is passed #21347

Closed
opened 2026-04-15 20:18:20 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/2699
Author: @ping-maxwell
Created: 5/18/2025
Status: Merged
Merged: 5/22/2025
Merged by: @Bekacru

Base: mainHead: update/trusted-origin/undefined-warning


📝 Commits (1)

  • c71fb53 update(trustedOrigin): Warn if invalid value is passed

📊 Changes

1 file changed (+5 additions, -0 deletions)

View changed files

📝 packages/better-auth/src/init.ts (+5 -0)

📄 Description

Right now, if an invalid trusted origin is passed, it becomes very hard to debug and find the cause of a given endpoint failing.

As far as I've seen, there error can be as undescriptive as:

dev: # SERVER_ERROR: TypeError: Cannot read properties of undefined (reading 'includes')
dev: at Array.some ()
dev: POST /api/auth/sign-up/email 500 in 915ms

This will throw an error stating that a valid trusted origins list is required.


🔄 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/2699 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 5/18/2025 **Status:** ✅ Merged **Merged:** 5/22/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `update/trusted-origin/undefined-warning` --- ### 📝 Commits (1) - [`c71fb53`](https://github.com/better-auth/better-auth/commit/c71fb53d9d05f42ef5ca821d85401d2f42a51f10) update(trustedOrigin): Warn if invalid value is passed ### 📊 Changes **1 file changed** (+5 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/init.ts` (+5 -0) </details> ### 📄 Description Right now, if an invalid trusted origin is passed, it becomes very hard to debug and find the cause of a given endpoint failing. As far as I've seen, there error can be as undescriptive as: > dev: # SERVER_ERROR: TypeError: Cannot read properties of undefined (reading 'includes') > dev: at Array.some (<anonymous>) > dev: POST /api/auth/sign-up/email 500 in 915ms This will throw an error stating that a valid trusted origins list is required. --- <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-15 20:18:20 -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#21347