chore: only show base url warning once

This commit is contained in:
Bereket Engida
2025-12-19 14:13:52 -08:00
parent fc78c7c041
commit ac6f495ac7

View File

@@ -104,10 +104,16 @@ export async function createAuthContext(
const logger = createLogger(options.logger);
const baseURL = getBaseURL(options.baseURL, options.basePath);
if (!baseURL && !options.advanced?.trustedProxyHeaders) {
let showBaseURLWarning = false;
if (
!baseURL &&
!options.advanced?.trustedProxyHeaders &&
!showBaseURLWarning
) {
logger.error(
`[better-auth] Base URL could not be determined. Please set a valid base URL using the baseURL config option or the BETTER_AUTH_BASE_URL environment variable. Without this, callbacks and redirects may not work correctly.`,
);
showBaseURLWarning = true;
}
const secret =