https://github.com/lldap/lldap logo
Hey everybody, I seem to be getting an issue on us...
# troubleshooting
s
Hey everybody, I seem to be getting an issue on user creation that is causing some strange behavior. I haven't taken a look at the code quite yet but it seems that I'm unable to create a user due to a constraint violation in the SQL DB:
Copy code
2022-11-30T04:32:11.599777639+00:00 INFO     HTTP request [ 504µs | 51.13% / 100.00% ]
2022-11-30T04:32:11.599783420+00:00 INFO     ┝━ i [info]:  | uri: /api/graphql
2022-11-30T04:32:11.599807235+00:00 DEBUG    ┝━ check_if_token_is_valid [ 24.5µs | 4.85% ]
2022-11-30T04:32:11.599831691+00:00 DEBUG    │  ┕━ 🐛 [debug]:  | return: ValidationResults { user: UserId("admin"), permission: Admin }
2022-11-30T04:32:11.600021078+00:00 DEBUG    ┝━ [GraphQL mutation] create_user [ 222µs | 2.00% / 44.01% ]
2022-11-30T04:32:11.600022351+00:00 DEBUG    │  ┝━ 🐛 [debug]:  | user.id: "poodah"
2022-11-30T04:32:11.600025026+00:00 DEBUG    │  ┝━ create_user [ 161µs | 31.83% ]
2022-11-30T04:32:11.600026889+00:00 DEBUG    │  │  ┕━ 🐛 [debug]:  | user_id: UserId("poodah")
2022-11-30T04:32:11.614692544+00:00 DEBUG    │  ┕━ get_user_details [ 51.4µs | 10.18% ]
2022-11-30T04:32:11.614695219+00:00 DEBUG    │     ┝━ 🐛 [debug]:  | user_id: UserId("poodah")
2022-11-30T04:32:11.615024381+00:00 DEBUG    │     ┕━ 🐛 [debug]:  | return: Ok(User { user_id: UserId("poodah"), email: "poodah@poodah.com", display_name: Some("poodah"), first_name: Some("poodah"), last_name: Some("poodah"), avatar: None, creation_date: 2022-11-30T04:32:11.600027250Z, uuid: Uuid("0e6eb87c-e300-3844-a7c3-e6d1aca68cd5") })
2022-11-30T04:32:11.615072712+00:00 INFO     ┕━ i [info]:  | status_code: 200
2022-11-30T04:32:11.632872886+00:00 INFO     HTTP request [ 232µs | 8.49% / 100.00% ]
2022-11-30T04:32:11.632874839+00:00 INFO     ┝━ i [info]:  | uri: /auth/opaque/register/start
2022-11-30T04:32:11.632889487+00:00 DEBUG    ┝━ opaque_register_start [ 213µs | 10.48% / 91.51% ]
2022-11-30T04:32:11.632890920+00:00 DEBUG    │  ┝━ check_if_token_is_valid [ 10.7µs | 4.62% ]
2022-11-30T04:32:11.632901470+00:00 DEBUG    │  │  ┕━ 🐛 [debug]:  | return: ValidationResults { user: UserId("admin"), permission: Admin }
2022-11-30T04:32:11.632919333+00:00 DEBUG    │  ┝━ get_user_groups [ 93.1µs | 40.09% ]
2022-11-30T04:32:11.632920636+00:00 DEBUG    │  │  ┝━ 🐛 [debug]:  | user_id: UserId("poodah")
2022-11-30T04:32:11.633562738+00:00 DEBUG    │  │  ┕━ 🐛 [debug]:  | return: {}
2022-11-30T04:32:11.633566806+00:00 DEBUG    │  ┕━ registration_start [ 84.3µs | 36.31% ]
2022-11-30T04:32:11.633664841+00:00 INFO     ┕━ i [info]:  | status_code: 200
2022-11-30T04:32:11.780342698+00:00 INFO     HTTP request [ 110µs | 33.15% / 100.00% ]
2022-11-30T04:32:11.780348439+00:00 INFO     ┝━ i [info]:  | uri: /auth/opaque/register/finish
2022-11-30T04:32:11.780397682+00:00 DEBUG    ┝━ opaque_register_finish [ 73.3µs | 6.02% / 66.85% ]
2022-11-30T04:32:11.780399666+00:00 DEBUG    │  ┕━ registration_finish [ 66.7µs | 60.83% ]
2022-11-30T04:32:11.780977056+00:00 ERROR    │     ┕━ 🚨 [error]:  | error: Database error: `Execution Error: error returned from database: (code: 1555) UNIQUE constraint failed: users.user_id`
2022-11-30T04:32:11.780988608+00:00 INFO     ┕━ i [info]:  | status_code: 500
Looking at the sqlite db file from before I created this user
Copy code
sqlite> select user_id from users;
admin
ldap_checker
raj
testing
uniquename
sqlite>
and then after:
Copy code
sqlite> select user_id from users;
user_id
admin
ldap_checker
poodah
raj
testing
uniquename
I see that all the user ids are unique but I see this regardless of whatever user I try to create even if the name is unique. This would be annoying but not a massive issue if the password hashes for the users with the failed constraint were not empty. Not sure if I've made a mistake while setting up the container or if there is an issue with the DML? I'm not an avid SQL lite user but I wonder if this is request to the DB is not wrapped in a transaction?
n
Hey! It seems you've stumbled on a new bug, due to the recent migration to an ORM. Thanks for the report, I found how to fix it.
If you want to contribute, there's plenty to do, even for new contributors! Look for issues marked as "good-first-issue", and depending on your taste, either "frontend" (still in Rust) or just "rust" (that's the backend).
Fix is merged, you can try to pull the docker image again
s
Awesome! Thanks for the rapid turn around. I’ll be sure to test this later today.
I pulled the latest image and everything seems to be working as expected. Checked my LLDAP land Authelia logs and no issues reported there. New user creation is working and password updates are working as well. Looking at the DB I see that new users are having their password hashes filled in as well as when existing users are updated, those changes are being reflected. Thanks so much!