Get idp token call returns a 500 internal error

Hi,

I was running Keycloak 10.0.2 docker and found an 500 internal server error when calling the external IDP token endpoint. Has anyone observed the same before and how to resolve it?

06:31:08,488 ERROR [org.keycloak.headers.DefaultSecurityHeadersProvider] (default task-16) MediaType not set on path /auth/realms/dummy-realm/broker/keycloak-oidc/token, with response status 200
06:31:08,489 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-16) Uncaught server error: javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error
at org.keycloak.keycloak-services@10.0.2//org.keycloak.headers.DefaultSecurityHeadersProvider.addHeaders(DefaultSecurityHeadersProvider.java:71)
at org.keycloak.keycloak-services@10.0.2//org.keycloak.services.filters.KeycloakSecurityHeadersFilter.filter(KeycloakSecurityHeadersFilter.java:36)

Charlie

@charlielj88 did you find any solution for this?

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.

Hi,
I have the same error with Keycloak 12.0.2, installed with this role 500 errors on theme files · Issue #2 · em0lar/ansible-role-keycloak-postgres · GitHub, use java 11, on RHEL8, separate postgresql server, data is written to database, but I get those errors

2021-01-26 20:30:51,936 WARN [org.keycloak.services] (default task-3) KC-SERVICES0075: Failed to get theme request: java.lang.NullPointerException

2021-01-26 20:30:51,930 ERROR [org.keycloak.headers.DefaultSecurityHeadersProvider] (default task-1) MediaType not set on path /auth/resources/purzq/common/keycloak/node_modules/patternf
ly/dist/css/patternfly.css, with response status 500

2021-01-26 20:30:51,934 ERROR [org.keycloak.headers.DefaultSecurityHeadersProvider] (default task-2) MediaType not set on path /auth/resources/purzq/common/keycloak/node_modules/patternf
ly/dist/css/patternfly-additions.css, with response status 500

Any idea hat I’m missing? The server answers but all the themes files, static files, are missing, and the auth interface is not usable like this.

I think came across a similar issue with Keycloak 12.0.4. It only manifests after restoring a clean Keycloak instance from a previous export.

They only way I’ve found to mitigate this is to un-link the account and link it again.

19:38:38,031 ERROR [org.keycloak.headers.DefaultSecurityHeadersProvider] (default task-1) MediaType not set on path /auth/realms/my-realm/broker/my-broker/token, with response status 200
19:38:38,032 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-1) Uncaught server error: javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error
	at org.keycloak.keycloak-services@12.0.4//org.keycloak.headers.DefaultSecurityHeadersProvider.addHeaders(DefaultSecurityHeadersProvider.java:75)
	at org.keycloak.keycloak-services@12.0.4//org.keycloak.services.filters.KeycloakSecurityHeadersFilter.filter(KeycloakSecurityHeadersFilter.java:39)
	at org.jboss.resteasy.resteasy-jaxrs@3.13.2.Final//org.jboss.resteasy.core.interception.ContainerResponseContextImpl.filter(ContainerResponseContextImpl.java:357)
	at org.jboss.resteasy.resteasy-jaxrs@3.13.2.Final//org.jboss.resteasy.core.ServerResponseWriter.executeFilters(ServerResponseWriter.java:219)
	at org.jboss.resteasy.resteasy-jaxrs@3.13.2.Final//org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:95)
	at org.jboss.resteasy.resteasy-jaxrs@3.13.2.Final//org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:69)
	at org.jboss.resteasy.resteasy-jaxrs@3.13.2.Final//org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:530)
	at org.jboss.resteasy.resteasy-jaxrs@3.13.2.Final//org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:461)
	at org.jboss.resteasy.resteasy-jaxrs@3.13.2.Final//org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:229)
	at org.jboss.resteasy.resteasy-jaxrs@3.13.2.Final//org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:135)
	at org.jboss.resteasy.resteasy-jaxrs@3.13.2.Final//org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:358)
	at org.jboss.resteasy.resteasy-jaxrs@3.13.2.Final//org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:138)
	at org.jboss.resteasy.resteasy-jaxrs@3.13.2.Final//org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:215)
	at org.jboss.resteasy.resteasy-jaxrs@3.13.2.Final//org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:245)
	at org.jboss.resteasy.resteasy-jaxrs@3.13.2.Final//org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:61)
	at org.jboss.resteasy.resteasy-jaxrs@3.13.2.Final//org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
	at javax.servlet.api@2.0.0.Final//javax.servlet.http.HttpServlet.service(HttpServlet.java:590)