leona-ya / ansible-role-keycloak-postgres

GNU General Public License v3.0
6 stars 3 forks source link

500 errors on theme files #2

Open cochennec opened 3 years ago

cochennec commented 3 years ago

Hi, When I use this role, I got 3 500 errors with css, that mention url endpoints like this http://:8080/auth/resources/jo2b5/welcome/keycloak/css/welcome.css

Same for other css patternfly.css and patternfly-addition.css and js called by the theme. I get the message

Keycloak
We are sorry...

Page not found

I don't really understand the jo2b5 in the url, I searched in the code and couldn't find anything related. Thanks for your help.

leona-ya commented 3 years ago

What do you mean with "3500 errors with css". Where do these issues appear?

As far as I know the jo2b5 is generated for each installation (it's regenerated on every new installation / migration of keycloak). You can find it in the database in the migration_model table. Can you please look there if it's in there?

Is this a fresh first keycloak installation (with or without this role) or did you upgrade keycloak to a new version?

cochennec commented 3 years ago

Hi, thanks for your answer, I deleted the database, recreated it empty, and re-played the playbook. I still get the same message, so I looked into the log file, and see many rows like those three.

2021-01-26 19:36:25,140 ERROR [org.keycloak.headers.DefaultSecurityHeadersProvider] (default task-23) MediaType not set on path /auth/resources/jo2b5/common/keycloak/web_modules/@pattern fly/react-core/dist/styles/app.css, with response status 500 2021-01-26 19:36:25,140 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-23) Uncaught server error: javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Serv er Error 2021-01-26 19:36:25,151 WARN [org.keycloak.services] (default task-25) KC-SERVICES0075: Failed to get theme request: java.lang.NullPointerException

I looked at the migration model table too

You are now connected to database "keycloak" as user "postgres".
keycloak=# SELECT * FROM migration_model;
  id   | version | update_time 
-------+---------+-------------
 vlqnc | 12.0.1  |  1611686270
cochennec commented 3 years ago

Maybe I should delete everything to make a fresh install of everything?

cochennec commented 3 years ago
You are now connected to database "keycloak" as user "postgres".
keycloak=# SELECT * FROM migration_model;
 id | version | update_time 
----+---------+-------------
(0 rows)

I stopped keycloak service, force removed the /opt/keycloak directory, deleted and recreated the database, now I have no migration row in the migration model table. When I get url /auth this appears.

keycloak=# SELECT * FROM migration_model;
  id   | version | update_time 
-------+---------+-------------
 yrn39 | 12.0.1  |  1611687422
(1 row)

So a migration happened? But I still get the errors on all theme files. In the logs, I still get

2021-01-26 19:59:33,725 WARN  [org.keycloak.services] (default task-1) KC-SERVICES0075: Failed to get theme request: java.lang.NullPointerException
2021-01-26 19:59:33,728 ERROR [org.keycloak.headers.DefaultSecurityHeadersProvider] (default task-1) MediaType not set on path /auth/resources/yrn39/common/keycloak/node_modules/patternf
ly/dist/css/patternfly.css, with response status 500
2021-01-26 19:59:33,733 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-1) Uncaught server error: javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Serve
r Error

But as you said, I have a line in migration_model table that corresponds to the path giving a 500 error (yrn39).

cochennec commented 3 years ago

I also saw this post https://stackoverflow.com/questions/61648880/cannot-create-resource-in-keycloak-getting-unknown-exception so I downgraded to Java 8 but same error happened, back to Java 14.

cochennec commented 3 years ago

Also found this https://keycloak.discourse.group/t/get-idp-token-call-returns-a-500-internal-error/3853/2 saying

I had a similar issue and I found it to be a network issue with the docker container with the keycloak image and the way I had set up my backend inside another docker service. I moved them to inside the same container and corrected all the references to localhost so that they were pointing to the docker localhost not the overall localhost.

Maybe I have to put a fqdn or an IP address somewhere instead of localhost?

cochennec commented 3 years ago

Also tried 12.0.2 keycloak version, same error.