helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

ERROR: duplicate key value violates unique constraint "constraint_40"

Open yurissouza opened this issue 3 years ago • 0 comments

Hello,

In some specific cases, when user tries to login on a application through Keycloak the user receives this error message on the browser: image

When we try to verify the problem with the keycloak, we can find this error message in the keycloak pod logs

16:21:45,896 WARN  [org.keycloak.events] (default task-33) type=REFRESH_TOKEN_ERROR, realmId=kubernetes, clientId=kubernetes-cluster, userId=<MASKED USER ID>, ipAddress=<MASKED IP>, error=invalid_token, grant_type=refresh_token, refresh_token_type=Offline, refresh_token_id=<MASKED REFRESH TOKEN IF>, client_auth_method=client-secret
16:23:23,079 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-33) SQL Error: 0, SQLState: 23505
16:23:23,079 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-33) ERROR: duplicate key value violates unique constraint "constraint_40"
  Detail: Key (identity_provider, user_id)=(WEBEAM, <MASKED USER ID>) already exists.

The "workaround" to enable the user to login again, is going to the keycloak UI and delete the user from the DB.

It's hard to troubleshoot this error 'cause I can not find a way to reproduce this error.

Does anyone have ideia on how to replicate this issue/error?

The chart version that we're using is 16.0.6.

yurissouza avatar Aug 08 '22 17:08 yurissouza