From 9ece6e88fe9a78a094bb1fe46d19e269c97dcba1 Mon Sep 17 00:00:00 2001 From: Erik Silva Date: Tue, 9 Dec 2025 02:21:06 -0300 Subject: [PATCH] debug: add tenant context logging to GetProfile --- backend/internal/api/handlers/agency_profile.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/internal/api/handlers/agency_profile.go b/backend/internal/api/handlers/agency_profile.go index 1ff6c18..012f0af 100644 --- a/backend/internal/api/handlers/agency_profile.go +++ b/backend/internal/api/handlers/agency_profile.go @@ -2,6 +2,7 @@ package handlers import ( "encoding/json" + "log" "net/http" "aggios-app/backend/internal/repository" @@ -59,8 +60,13 @@ func (h *AgencyHandler) GetProfile(w http.ResponseWriter, r *http.Request) { // Get tenant from context (set by middleware) tenantID := r.Context().Value("tenantID") + log.Printf("DEBUG GetProfile: tenantID from context = %v (type: %T)", tenantID, tenantID) + if tenantID == nil { - http.Error(w, "Tenant not found", http.StatusUnauthorized) + log.Printf("DEBUG GetProfile: tenantID is nil, checking subdomain from context") + subdomain := r.Context().Value("subdomain") + log.Printf("DEBUG GetProfile: subdomain = %v", subdomain) + http.Error(w, "Tenant not found in context", http.StatusUnauthorized) return }