fix: Avoid logging error when team not found in apex auth redirect (#12478)

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Tom Moor
2026-05-26 20:29:18 -04:00
committed by GitHub
parent 64ccdca0d7
commit 2c3e736eb3
+4 -1
View File
@@ -39,9 +39,12 @@ export default function apexAuthRedirect<T>({
try {
const team = await Team.findByPk(teamId, {
attributes: ["id", "domain", "subdomain"],
rejectOnEmpty: true,
});
if (!team) {
return ctx.redirect(getErrorPath(ctx));
}
return parseDomain(ctx.host).teamSubdomain === team.subdomain
? ctx.redirect("/")
: ctx.redirectOnClient(getRedirectPath(ctx, team));