Skip to content

Conversation

theRolento
Copy link

☕️ Reasoning

The @auth/sveltekit adapter currently overwrites any user-defined basePath with the default /auth. This is caused by an unconditional assignment in packages/frameworks-sveltekit/src/lib/env.ts.

This change replaces the direct assignment (=) with the nullish coalescing assignment operator (??=).

This ensures that a user-provided basePath in the SvelteKitAuth configuration is respected, while still falling back to the default /auth if no basePath is provided. This fixes the issue where users setting a custom path (e.g., /api/auth) would receive 404 errors because the handler was not listening on the configured route.

🧢 Checklist

  • Documentation
  • Tests
  • Ready to be merged

🎫 Affected issues

Fixes: #11584

📌 Resources

@theRolento theRolento requested a review from ThangHuuVu as a code owner August 17, 2025 17:01
Copy link

vercel bot commented Aug 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
auth-docs Ready Ready Preview Comment Aug 17, 2025 5:05pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
next-auth-docs Ignored Ignored Preview Aug 17, 2025 5:05pm

Copy link

vercel bot commented Aug 17, 2025

@theRolento is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SvelteKit: only modify basePath in SvelteKitAuth cause incorrect URL
1 participant