Skip to content

Commit

Permalink
Fix/prevent returning error from external cache (#1576)
Browse files Browse the repository at this point in the history
* Prevent returning error from external cache query

* link comment

* fix spell and remove unnecessary return
  • Loading branch information
mlsmaycon authored Feb 13, 2024
1 parent e890fda commit cf87f1e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions management/server/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit cf87f1e

Please sign in to comment.