[PR #9113] fix: resolve dynamic baseURL for direct auth.api calls #16691

Open
opened 2026-04-13 10:38:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/9113
Author: @bytaesu
Created: 4/11/2026
Status: 🔄 Open

Base: mainHead: 2026-04-11/fix/dynamic-baseurl-api-calls


📝 Commits (8)

  • 4fc1eee fix: resolve dynamic baseURL for direct auth.api calls
  • 4fa8201 chore: add changeset
  • 56d2704 fix: apply fallback support and https placeholder for dynamic baseURL
  • c3aeda0 refactor: eliminate fake Request wrapper in dynamic baseURL resolution
  • 71e0ab6 Merge branch 'main' into 2026-04-11/fix/dynamic-baseurl-api-calls
  • f87fd55 refactor: simplify isRequestLike
  • 6cc85af refactor: remove unnecessary type casting
  • 908d431 refactor: rename FromRequest helpers to FromSource

📊 Changes

7 files changed (+266 additions, -81 deletions)

View changed files

.changeset/lovely-toes-swim.md (+5 -0)
📝 packages/better-auth/src/api/to-auth-endpoints.test.ts (+93 -0)
📝 packages/better-auth/src/api/to-auth-endpoints.ts (+38 -1)
📝 packages/better-auth/src/auth/base.ts (+9 -42)
📝 packages/better-auth/src/context/helpers.ts (+56 -1)
📝 packages/better-auth/src/utils/url.test.ts (+13 -13)
📝 packages/better-auth/src/utils/url.ts (+52 -24)

📄 Description

Note

Functions like getProtocolFromRequest previously assumed a Request was always present. However, when using better-call without requireRequest, calls can be made with headers only. This PR fixes that assumption.


🔄 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/9113 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 4/11/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `2026-04-11/fix/dynamic-baseurl-api-calls` --- ### 📝 Commits (8) - [`4fc1eee`](https://github.com/better-auth/better-auth/commit/4fc1eeea0c3397d67a780c1e366c701db01544c1) fix: resolve dynamic baseURL for direct auth.api calls - [`4fa8201`](https://github.com/better-auth/better-auth/commit/4fa8201c2c93f52d4e30f6b58e287c4c277a5418) chore: add changeset - [`56d2704`](https://github.com/better-auth/better-auth/commit/56d2704828220e77c94375d64c19260cb6caabb3) fix: apply fallback support and https placeholder for dynamic baseURL - [`c3aeda0`](https://github.com/better-auth/better-auth/commit/c3aeda09f1b6fbfcdd654c5b7f5a1fe85497d106) refactor: eliminate fake Request wrapper in dynamic baseURL resolution - [`71e0ab6`](https://github.com/better-auth/better-auth/commit/71e0ab684fb1a902c2753ec495d4902665eded28) Merge branch 'main' into 2026-04-11/fix/dynamic-baseurl-api-calls - [`f87fd55`](https://github.com/better-auth/better-auth/commit/f87fd55e2a948a0c60c6db8d876f6ff7d6223d3c) refactor: simplify isRequestLike - [`6cc85af`](https://github.com/better-auth/better-auth/commit/6cc85af8097d8e004a69c97ab2708ccbb12b19c7) refactor: remove unnecessary type casting - [`908d431`](https://github.com/better-auth/better-auth/commit/908d4317ce52abf7e34133936089f55296d5f85c) refactor: rename FromRequest helpers to FromSource ### 📊 Changes **7 files changed** (+266 additions, -81 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/lovely-toes-swim.md` (+5 -0) 📝 `packages/better-auth/src/api/to-auth-endpoints.test.ts` (+93 -0) 📝 `packages/better-auth/src/api/to-auth-endpoints.ts` (+38 -1) 📝 `packages/better-auth/src/auth/base.ts` (+9 -42) 📝 `packages/better-auth/src/context/helpers.ts` (+56 -1) 📝 `packages/better-auth/src/utils/url.test.ts` (+13 -13) 📝 `packages/better-auth/src/utils/url.ts` (+52 -24) </details> ### 📄 Description > [!NOTE] > Functions like `getProtocolFromRequest` previously assumed a `Request` was always present. However, when using `better-call` without `requireRequest`, calls can be made with headers only. This PR fixes that assumption. - Closes #9105 --- <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-13 10:38: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#16691