Closed oliverrahner closed 5 months ago
same here, but with sqlite3
Found the next level of the issue:
user.id
is not a UUID, but a 16-byte (32-char) hex string.
That's why is_valid_uuid
returns false
on this value, leading to a search for username instead of user ID.
The problem is this line: https://github.com/papermerge/auth-server/blob/0f19caf2c67da2142556b04cd2456bd3af66f250/auth_server/crud.py#L84
So it only relates to user accounts that are created via the auth-server
, the creation from inside core
seems to be fine, because it does not convert the UUIDs to a pure .hex()
representation.
@oliverrahner thank you for awesome report!
Issue seems to happen only with mysql/mariadb/sqlite, but not with postgres.
I will fix auth_server.crud.create_user
function to insert UUIDs similarely to the one from the papermerge.core.db.users.create_user
.
Sqlalchemy seems to map UUID field types to char columns for mysql (with a fixed 32 char size!), which makes the format very explicit, leading to the issue with these differences… The fixed size also means that you wouldn’t be able to save the UUID including the dashes, making the fix more complex 😏
@oliverrahner @schischo
I've published 3.0.2 which should fix current issue (uuid/mysql/sqlite thingy). Also in documentation I've updated docker-compose examples to include healthcheck key - which ensures that webapp/workers will start only after database process (not just db container) is up and running.
@ciur I can confirm this fixed my issue!
Description
Situation:
docker-compose.yml
below)/api/users/me
fails with an HTTP 500The JWT for the request to
/api/users/me
is this:In the logs I see:
The actual database query is this:
So seemingly, somewhere username and user id get mixed up, because the query tries to find a user that has his id as name. When I change the username to the user's id, I can log in, and other issues appear then but maybe that's something for a follow up.
Info:
docker-compose.yml
: