-
Notifications
You must be signed in to change notification settings - Fork 145
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
Comments
I also experience the same issue, but only get it when running keycloak-config-cli while the Keycloak cluster nodes are still starting up (i.e. cluster is not in a healthy state) But indeed NPE is not helpful |
Hi @davidfrickert, Thank you for bringing this to my attention. I replicated your development environment and identified that the root cause originates from the handling of the {
"realm": "some-realm",
"attributes": {
"cibaBackchannelTokenDeliveryMode": "poll",
"cibaExpiresIn": "120",
"cibaAuthRequestedUserHint": "login_hint",
"parRequestUriLifespan": "60",
"cibaInterval": "5",
"realmReusableOtpCode": "false"
}
} {
"realm": "some-realm",
"displayName": "displayName"
} +] Running 3/0
✔ Container 4b629a0cd88ef1962bde54ca57c64c83-964cfb4ea0dc3b449390a87b2eeb71992e04bf4d-mysql-1 Running 0.0s
✔ Container 4b629a0cd88ef1962bde54ca57c64c83-964cfb4ea0dc3b449390a87b2eeb71992e04bf4d-idp-1 Running 0.0s
✔ Container 4b629a0cd88ef1962bde54ca57c64c83-964cfb4ea0dc3b449390a87b2eeb71992e04bf4d-import-1 Created 0.0s
Attaching to kcc-1
kcc-1 | 2024-11-06 12:14:15.075 INFO 1 --- [ main] d.a.k.config.KeycloakConfigApplication : Starting KeycloakConfigApplication v5.12.0 using Java 17.0.10 on d9bb29bbf078 with PID 1 (/app/keycloak-config-cli.jar started by nobody in /)
kcc-1 | 2024-11-06 12:14:15.079 INFO 1 --- [ main] d.a.k.config.KeycloakConfigApplication : No active profile set, falling back to 1 default profile: "default"
kcc-1 | 2024-11-06 12:14:16.176 INFO 1 --- [ main] d.a.k.config.KeycloakConfigApplication : Started KeycloakConfigApplication in 2.039 seconds (JVM running for 2.781)
kcc-1 | 2024-11-06 12:14:17.854 INFO 1 --- [ main] d.a.k.config.KeycloakConfigRunner : Importing file 'file:/changes/some-realm.json'
kcc-1 | 2024-11-06 12:14:21.729 INFO 1 --- [ main] d.a.k.config.KeycloakConfigRunner : keycloak-config-cli running in 00:04.211.
kcc-1 exited with code 0 I improved the logging mechanism by incorporating more descriptive messages for enhanced clarity and debugging efficiency. |
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 viakeycloak-config-cli
.Error message:
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:
{"id":"test","realm":"test","attributes":{}}
to Keycloak viakc.sh import
.{"id":"test","realm":"test","displayName":"just-a-name"}
to Keycloak viakeycloak-config-cli
.Environment
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 viakeycloak-config-cli
and then export it again to check for unexpected differences.The text was updated successfully, but these errors were encountered: