From 02b9378018d7e1169c09b5c9fd0133557c71062e Mon Sep 17 00:00:00 2001 From: Konstantin Wohlwend Date: Thu, 15 May 2025 12:27:33 -0700 Subject: [PATCH] Fetch tenancy in non-GET /users/me --- apps/backend/src/route-handlers/smart-request.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/backend/src/route-handlers/smart-request.tsx b/apps/backend/src/route-handlers/smart-request.tsx index 2f6138ea9..fdd72f7fa 100644 --- a/apps/backend/src/route-handlers/smart-request.tsx +++ b/apps/backend/src/route-handlers/smart-request.tsx @@ -239,7 +239,7 @@ const parseAuth = withTraceSpan('smart request parseAuth', async (req: NextReque const project = await queriesResults.project; // TODO HACK tenancy is not needed for /users/me, so let's not fetch it as a hack to make the endpoint faster. Once we refactor this stuff, we can fetch the tenancy in the rawQuery and won't need this anymore - const tenancy = req.url.endsWith("/users/me") ? "tenancy not available in /users/me as a performance hack" as never : await getSoleTenancyFromProjectBranch(projectId, branchId, true); + const tenancy = req.method === "GET" && req.url.endsWith("/users/me") ? "tenancy not available in /users/me as a performance hack" as never : await getSoleTenancyFromProjectBranch(projectId, branchId, true); if (developmentKeyOverride) { if (getNodeEnvironment() !== "development" && getNodeEnvironment() !== "test") {