-
-
Notifications
You must be signed in to change notification settings - Fork 53
TypeError: Object of type KeycloakRole is not JSON serializable #30
Comments
Hi @fherrera124. Could you please provide the whole user you're trying to register and at which point you get the serializing error? |
Sure, this is my function:
This is the list containing a valid role:
The output of the error:
|
Seems like the response by Keycloak isn't valid JSON or mismatches the Pydantic model. Could you please debug into the Keycloak response (E.g. breakpoint at line 59 of |
The object returned:
The object is a list, if I ask for the attribute
If try with
|
This was indeed an issue. The initial roles were directly dumped to JSON from the Pydantic model which didn't work quite well. Should be fixed in |
Thanks, great work. |
Just tested, it always returns error 500 :/ So, for now, first I'm creating the user, and then adding the role to that user (yesterday it worked). UPDATE: New bug introduced, if there are no initial roles, now fails with this:
|
Turns out I tested the wrong version 🥲 Also, the Keycloak documentation was misleading so the |
Thanks, the errors are gone now. But from the KeyCloak Admin Console I'm seeing that the new users didn't get the initial roles. It's no big deal for me, I will stick with the procedure of creating users without roles, and then add them. |
Hmm, seems like that's the case... thanks for pointing that out. For convenience, I'll change the API to make additional requests for the initial roles for now |
I'll not say "it's fixed" anymore today. But I think it's finally working as expected in v1.0.4. Though I had to add the initial roles in additional requests. |
May also be related to keycloak/keycloak#9342. Further introspection required. |
Whenever I try to create an user with an initial role, I get the error: "TypeError: Object of type KeycloakRole is not JSON serializable"
The text was updated successfully, but these errors were encountered: