[PR #5902] fix: validate baseURL protocol and improve error messages #14555

Closed
opened 2026-04-13 09:31:39 -05:00 by GiteaMirror · 0 comments
Owner

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

State: closed
Merged: Yes


Using localhost:3000 (without protocol) as baseURL in env vars caused unclear errors during schema generation. This adds protocol validation with actionable error messages to improve DX.


Summary by cubic

Validate baseURL protocol and show clear errors when it's missing or unsupported. This prevents misconfigurations and improves DX by only allowing http/https.

  • Bug Fixes
    • Enforce http/https protocols via URL parsing in withPath().
    • Throw BetterAuthError with actionable messages for invalid or malformed base URLs.
    • Add tests for missing protocol and ws:// URLs.

Written for commit 310db3400b. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5902 **State:** closed **Merged:** Yes --- Using localhost:3000 (without protocol) as baseURL in env vars caused unclear errors during schema generation. This adds protocol validation with actionable error messages to improve DX. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Validate baseURL protocol and show clear errors when it's missing or unsupported. This prevents misconfigurations and improves DX by only allowing http/https. - **Bug Fixes** - Enforce http/https protocols via URL parsing in withPath(). - Throw BetterAuthError with actionable messages for invalid or malformed base URLs. - Add tests for missing protocol and ws:// URLs. <sup>Written for commit 310db3400bcd67ced64de588bd4d800a7ca95d78. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
GiteaMirror added the pull-request label 2026-04-13 09:31:39 -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#14555