dasniko / testcontainers-keycloak

A Testcontainer implementation for Keycloak IAM & SSO.
Apache License 2.0
327 stars 50 forks source link

Can't update from 1.9.0 to 2.5; Can't load realm #101

Closed GregJohnStewart closed 1 year ago

GregJohnStewart commented 1 year ago

Describe the bug

I'm looking at updating my testcontainer for keycloak from 1.9.0 to 2.5.0. Unfortunately, this comes up with problems.

Initially, I get the following error:

Failed to migrate json representation for version: 21.0.0: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "adminTheme" is null

From this, I add the "adminTheme": "keycloak" entry in my keycloak-realm.json file, but then I get an additional error:

[org.keycloak.services] (main) KC-SERVICES0050: Initializing master realm
INFO  [org.keycloak.exportimport.dir.DirImportProvider] (main) Importing from directory /opt/keycloak/bin/../data/import
INFO  [org.keycloak.exportimport.util.ImportUtils] (main) Realm 'apps' imported
ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to start server in (development) mode
ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Script upload is disabled

I have tried enabling that feature with .withFeaturesEnabled("upload_scripts") on my container object, but no help there.

Any ideas?

Version

2.5

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Relevant log output

No response

Anything else?

No response

dasniko commented 1 year ago

Thanks for reporting. Both issues are not related to this project, but to the Keycloak server itself.

The first one is a current issue with 21.0.0, this will be fixed with 21.0.1 soon. As soon it is release, just remove your local image for 21.0 and/or do a new pull, then you will get the most recent version.

The second one is due to the removed option to upload scripts to the server, there is no more feature which can be enabled. You have to clean-up your realm json file. My guess is, that it is most likely some authorization node in the JSON, but I don't exactly which node/attribute in your JSON might produce this.