Import Realm in Keycloak 18.0.0 - failed
See original GitHub issueDescribe the bug
I’m using a docker image and I uploaded the realm.json in /opt/keycloak/data/import to get the nice auto import functionality.
When I add now to start --import-realm I get:
2022-04-26 08:28:56,195 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to start server in (production) mode
2022-04-26 08:28:56,195 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to import realm: myrealm
2022-04-26 08:28:56,195 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Script upload is disabled
which confuses me, because
Script Upload should be removed (why is import using that?) and
doesn’t work.
Without the --import-realm all works fine
Reference to documentation: https://www.keycloak.org/server/importExport
Version
18.0.0
Expected behavior
To import the realms automatically from the data/import location.
Actual behavior
Gives an error
How to Reproduce?
- create a dockerfile
- add a realm.json to the path
- build keycloak in docker file
- build dockerfile
- start container
Anything else?
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Import Realm in Keycloak 18.0.0 - failed
I'm using a docker image and I uploaded the realm.json in /opt/keycloak/data/import to get the nice auto import functionality.
Read more >Import realm in Keycloak:18.x - Stack Overflow
This might be caused because inside of your realm .json there is references to some configuration that is using the deprecated upload script ......
Read more >Export realm users dont work Keycloak 18 (Docker) #13405
I'n running Keycloak 18.0. 2 in dev mode. Exportering the realm via the admin console works fine, although I would like my users...
Read more >Keycloak 18.0.0 released
Import realms at startup. The Keycloak Quarkus distribution now supports importing your realms directly at start-up. For more information, check ...
Read more >Keycloak 18 / Export and Import Feature
ExecutionExceptionHandler] (main) ERROR: Failed to import realm: RBAC 2022-04-28 ... quay.io/keycloak/keycloak:18.0.0 "/opt/keycloak/bin/k…
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had the same issue and based on your feedback I search and found I had these policies for one of the realm clients:
I checked and these were not referenced anywhere else so I proceeded to delete them and it worked.
I guess it was created automatically by a previous version of KC.
For anyone else experiencing the same issue: search for
"type": "js"to pin-point the root cause in the realm export file.``> @edwint88 Is your realm declaring providers that rely on scripts such as mappers, authenticators, or policies?
We have an Authenticator, but not a JavaScript one. It’s a simple Java SPI that we add through .jar in
/opt/keycloak/providersand then, yes, configured in the realm.json. Is this affected too?LE: thanks for the
"type": "js"hint! we got a default policy - that we didn’t create it, I’ll check without that in the config.{ "id": "cf9f7684-45c2-4bcd-89a5-38c2a41b55fd", "name": "Default Policy", "description": "A policy that grants access only for users within this realm", "type": "js", "logic": "POSITIVE", "decisionStrategy": "AFFIRMATIVE", "config": { "code": "// by default, grants any permission associated with this policy\n$evaluation.grant();\n" } }That was the problem! So when I’ve created a dummy confidential client in 17.0.1 the Default JS policies were activated!