Vercel Preview runtime logs or browser

BetterAuthError: Invalid origin: https://…-git-….vercel.app is not a trusted origin

What it means
You tried to sign in on a Vercel Preview link, and Better Auth blocked the request because it hasn't been told to trust your project's Preview URLs yet.
Likely causes
  • trustedOrigins in your Better Auth configuration only lists localhost:3000 and the production domain.
  • BETTER_AUTH_URL is hardcoded to Production even when running on a Preview deployment.
Prevention
Always test sign-up and sign-in on a Preview link before merging your auth branch.

Copy for your agent

Signing in on my Preview link fails with `Invalid origin: not a trusted origin`. Use the `better-auth-security-best-practices` skill to configure `trustedOrigins` safely for our Vercel Preview URLs.

Full help articleLogins don't work on Preview links

Last reviewed Nov 8, 2026