Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Map.get(Object)" because "customAttributes" is null #1010

Open
moritzschmitz-oviva opened this issue Apr 17, 2024 · 0 comments
Labels

Comments

@moritzschmitz-oviva
Copy link

moritzschmitz-oviva commented Apr 17, 2024

Current Behavior

I am receiving this error Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Map.get(Object)" because "customAttributes" is null when trying to import a realm config via keycloak-config-cli.

Error message:

Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Map.get(Object)" because "customAttributes" is null
  at de.adorsys.keycloak.config.service.checksum.ChecksumService.hasToBeUpdated(ChecksumService.java:64)
  at de.adorsys.keycloak.config.service.RealmImportService.updateRealmIfNecessary(RealmImportService.java:151)
  at de.adorsys.keycloak.config.service.RealmImportService.doImport(RealmImportService.java:144)
  at de.adorsys.keycloak.config.KeycloakConfigRunner.run(KeycloakConfigRunner.java:79)
  at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:768)
  ... 13 common frames omitted

Expected Behavior

Well, I was hoping at least for a more meaningful error message.

Steps To Reproduce

Get files from: https://gist.github.com/moritzschmitz-oviva/4b629a0cd88ef1962bde54ca57c64c83.

mkdir tmp
wget https://gist.github.com/moritzschmitz-oviva/4b629a0cd88ef1962bde54ca57c64c83/archive/964cfb4ea0dc3b449390a87b2eeb71992e04bf4d.zip
unzip 964cfb4ea0dc3b449390a87b2eeb71992e04bf4d.zip -d tmp
rm 964cfb4ea0dc3b449390a87b2eeb71992e04bf4d.zip
cd tmp/4b629a0cd88ef1962bde54ca57c64c83-964cfb4ea0dc3b449390a87b2eeb71992e04bf4d
mkdir -p before
mv before-some-realm.json before/some-realm.json
mkdir -p changes
mv changes-some-realm.json changes/some-realm.json
docker compose up kcc

Without using my setup, it should be reproducible like this as well:

  1. Import {"id":"test","realm":"test","attributes":{}} to Keycloak via kc.sh import.
  2. Import {"id":"test","realm":"test","displayName":"just-a-name"} to Keycloak via keycloak-config-cli.

Environment

  • Keycloak Version: 23.0.7
  • keycloak-config-cli Version: 5.12.0-23.0.7

Anything else?

My goal is to migrate an existing Keycloak installation to using keycloak-config-cli. To ensure I am not changing more or less than what we need I import the current realm config into a local instance, apply config via keycloak-config-cli and then export it again to check for unexpected differences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant