p2-inc / phasetwo

Phase Two public repo for feature requests and issue tracking
0 stars 0 forks source link

Import realm-export.json failed with: Protocol mapper name must be unique per protocol #8

Closed thelmn closed 1 month ago

thelmn commented 10 months ago

I am running the p2/keycloak image, and made some config changes on the admin console (new realm, clients e.t.c) to support auth on my app, which is running fine. I then exported the config on the dashboard (Admin > Realm Settings > Partial export). When I try importing this config, either in the 1) Create new realm page or 2) Create a new realm, go to realm settinngs > partial import, the import fails with: 'Protocol mapper name must be unique per protocol'

`ERROR [org.keycloak.services.resources.admin.RealmsAdminResource] (executor-thread-4) Conflict detected: org.keycloak.models.ModelDuplicateException: Protocol mapper name must be unique per protocol

| at org.keycloak.models.jpa.ClientAdapter.addProtocolMapper(ClientAdapter.java:399)

| at io.phasetwo.portal.PortalResourceProviderFactory.setOrganizationRoleMapper(PortalResourceProviderFactory.java:144)

| at io.phasetwo.portal.PortalResourceProviderFactory.setClientScopeDefaults(PortalResourceProviderFactory.java:182)

| at io.phasetwo.portal.PortalResourceProviderFactory.createClient(PortalResourceProviderFactory.java:89)

| at io.phasetwo.portal.PortalResourceProviderFactory.realmPostCreate(PortalResourceProviderFactory.java:74)

| at io.phasetwo.portal.PortalResourceProviderFactory.lambda$postInit$0(PortalResourceProviderFactory.java:50)

... `

On the realm settings > partial import page, the dashboard is able to detect the 8 clients, 3 realm roles, 32 client roles contained in the json file.

xgp commented 10 months ago

Are you using the most recent image? We solved a similar issue a few days ago.

If you are seeing this problem on the latest image, then we need to see your realm json file in order to help you debug.