From b43ebabbafe95d27e423fbc3604a8463ec697c10 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 14 May 2025 19:37:16 -0400 Subject: [PATCH] fix: Apex redirect regression (#9214) --- server/middlewares/apexAuthRedirect.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/middlewares/apexAuthRedirect.ts b/server/middlewares/apexAuthRedirect.ts index 6b959b7273..5114f52b0c 100644 --- a/server/middlewares/apexAuthRedirect.ts +++ b/server/middlewares/apexAuthRedirect.ts @@ -1,5 +1,6 @@ import { Next } from "koa"; import { parseDomain } from "@shared/utils/domains"; +import Logger from "@server/logging/Logger"; import { Team } from "@server/models"; import { APIContext } from "@server/types"; @@ -37,7 +38,7 @@ export default function apexAuthRedirect({ if (teamId) { try { const team = await Team.findByPk(teamId, { - attributes: ["id", "subdomain"], + attributes: ["id", "domain", "subdomain"], rejectOnEmpty: true, }); @@ -45,6 +46,7 @@ export default function apexAuthRedirect({ ? ctx.redirect("/") : ctx.redirectOnClient(getRedirectPath(ctx, team)); } catch (err) { + Logger.error("Error fetching team", err); return ctx.redirect(getErrorPath(ctx)); } } else {