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 }