Skip to main content

Fix BaseRepository invalidateCacheById

When we cache user documents by ID, we use a key based on an object like { filter: { _id: "ObjectId" } }

Then, during the login request, we attempt to invalidate the cached user by calling BaseRepository.invalidateCacheById, which internally triggers invalidateCacheByFilterId asynchronously.


As a result, in some cases, the next request in the test scenario might be executed before invalidateCacheByFilterId has completed. This leads to the user being retrieved from the cache instead of the database, causing the Unauthorized issue reported by many CI/CD executions — specifically, the cached user does not contain the token returned during login.

Domain
AuthN-Z
Action
hotfix
Department
Backend
Status: Completed

Log in to comment and vote

No comments yet

Be the first to share your thoughts.