[PR #8649] fix(oauth-provider): handle dynamic baseURL config in init #16365

Closed
opened 2026-04-13 10:30:15 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/8649

State: closed
Merged: Yes


Summary

  • The oauth-provider plugin's init() crashes with TypeError: Invalid URL when baseURL uses the object format { allowedHosts, protocol }
  • ctx.baseURL is an empty string during initialization (it's only resolved per-request for dynamic configs)
  • Now gracefully skips init warnings when the URL can't be parsed

Closes #8559

Test plan

  • Configure baseURL with object format { allowedHosts, protocol } alongside oauthProvider plugin
  • Run npx auth generate — should no longer crash with TypeError: Invalid URL
**Original Pull Request:** https://github.com/better-auth/better-auth/pull/8649 **State:** closed **Merged:** Yes --- ## Summary - The oauth-provider plugin's `init()` crashes with `TypeError: Invalid URL` when `baseURL` uses the object format `{ allowedHosts, protocol }` - `ctx.baseURL` is an empty string during initialization (it's only resolved per-request for dynamic configs) - Now gracefully skips init warnings when the URL can't be parsed Closes #8559 ## Test plan - Configure `baseURL` with object format `{ allowedHosts, protocol }` alongside `oauthProvider` plugin - Run `npx auth generate` — should no longer crash with `TypeError: Invalid URL`
GiteaMirror added the pull-request label 2026-04-13 10:30:15 -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#16365