From 88c965bab3f3ad8893f24fb5bfca8b70ce4ccb13 Mon Sep 17 00:00:00 2001 From: Ayush7614 Date: Tue, 1 Sep 2026 14:16:29 +0530 Subject: [PATCH] fix(server): align TRUSTED_ORIGINS fallback with app default port 3010 server/src/config.ts:503-505 fell back to http://localhost:3000 while every other default in the repo is 3010 (.env.example:94, app/vite.config.ts:15, scripts/start.sh:28). With TRUSTED_ORIGINS unset (e.g. singleUser or minimal staging), Better-Auth validated against a port nothing listens on and OAuth callbacks 404'd while BETTER_AUTH_URL stayed on 3001. The mismatch is silent until first sign-in and singleUser hides it locally. appUrl also reads TRUSTED_ORIGINS[0], so the wrong fallback propagated there. Change the fallback to 3010 and align config.test.ts:199. No schema or dependency changes. --- server/src/config.ts | 2 +- server/tests/config.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/config.ts b/server/src/config.ts index 0bcfc9d2a..1c235f9c3 100644 --- a/server/src/config.ts +++ b/server/src/config.ts @@ -502,7 +502,7 @@ function authConfig( secret, trustedOrigins: commaSeparated(environment, "TRUSTED_ORIGINS").length ? commaSeparated(environment, "TRUSTED_ORIGINS") - : ["http://localhost:3000"], + : ["http://localhost:3010"], initialAdminEmails, ...(google ? { google } : {}), ...(microsoft ? { microsoft } : {}), diff --git a/server/tests/config.test.ts b/server/tests/config.test.ts index 394124fcd..5b1d9ce2a 100644 --- a/server/tests/config.test.ts +++ b/server/tests/config.test.ts @@ -196,7 +196,7 @@ describe("deployment configuration", () => { clientId: "google-client-id", clientSecret: "google-client-secret", }, - trustedOrigins: ["http://localhost:3000"], + trustedOrigins: ["http://localhost:3010"], initialAdminEmails: ["admin@openbot.test", "owner@openbot.test"], }); });