From cf87f1e702172b8f786c50e91dc003270cbcd677 Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Tue, 13 Feb 2024 13:10:17 +0100 Subject: [PATCH] Fix/prevent returning error from external cache (#1576) * Prevent returning error from external cache query * link comment * fix spell and remove unnecessary return --- management/server/account.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/management/server/account.go b/management/server/account.go index 91b0e4883f1..37bd65bb2fe 100644 --- a/management/server/account.go +++ b/management/server/account.go @@ -1223,6 +1223,8 @@ func (am *DefaultAccountManager) lookupUserInCache(userID string, account *Accou } } + // add extra check on external cache manager. We may get to this point when the user is not yet findable in IDP, + // or it didn't have its metadata updated with am.addAccountIDToIDPAppMeta user, err := account.FindUser(userID) if err != nil { log.Errorf("failed finding user %s in account %s", userID, account.Id) @@ -1232,8 +1234,7 @@ func (am *DefaultAccountManager) lookupUserInCache(userID string, account *Accou key := user.IntegrationReference.CacheKey(account.Id, userID) ud, err := am.externalCacheManager.Get(am.ctx, key) if err != nil { - log.Errorf("failed to get externalCache for key: %s, error: %s", key, err) - return nil, status.Errorf(status.NotFound, "user %s not found in the IdP", userID) + log.Debugf("failed to get externalCache for key: %s, error: %s", key, err) } return ud, nil