Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when creating a user with a non-unique name. #2955

Closed
dessalines opened this issue Jun 7, 2023 · 8 comments · Fixed by #3093
Closed

Error when creating a user with a non-unique name. #2955

dessalines opened this issue Jun 7, 2023 · 8 comments · Fixed by #3093

Comments

@dessalines
Copy link
Member

          This happens with any error, not just with email verification.  

For example here's the log if I try to sign up when registration is closed

2023-06-07T18:03:35.070511Z ERROR HTTP request{http.method=GET http.scheme="https" http.host=lemmy.pe1uca.dev http.target=/api/v3/ws otel.kind="server" request_id=bd92d4fa-90e5-4d03-b2e3-8a1c39b645fa http.status_code=101 otel.status_code="OK"}: lemmy_server::api_routes_websocket: registration_closed: registration_closed

Here's when a duplicate user exists

thread 'actix-rt|system:0|arbiter:0' panicked at 'couldnt create local user: DatabaseError(UniqueViolation, "duplicate key value violates unique constraint \"local_user_person_id_key\"")', crates/db_schema/src/impls/local_user.rs:157:8

All of them don't send a response to the UI.
It can be easily verified in the network tab of the browser watching the websocket interaction, it sends the operation Register and the server never gets back.

Originally posted by @pe1uca in LemmyNet/lemmy-ui#1062 (comment)

@RocketDerp

This comment was marked as abuse.

@pe1uca
Copy link
Contributor

pe1uca commented Jun 7, 2023

I think the original report isn't limited to creating a user with a non-unique name.
This ticket can be focused on this issue since seems the DB error isn't properly catch in code as the logs is thread panicked at (maybe I'm not well versed in rust)

The original issue is the server doesn't properly return an explanation is something fails, in this case when we see in the logs ERROR HTTP request

Not sure if it's possible since I haven't fully looked into the code, the backend needs to send a default error format to the UI, I mean send {"op":"operation","data":{},"error":"Something went wrong"} when any unhanlded error occurs, this could also be reused for specific errors.
This way the UI could just check if the error key is present (or non-empty) and display the message to the user.

@Nutomic
Copy link
Member

Nutomic commented Jun 8, 2023

User registration is handled here. There is an attempt to check for duplicate usernames but apparently its not working correctly. You can setup a dev environment and test how to get it working properly.

@th3raid0r
Copy link

What version do I need to roll back to, to get this working? v0.17.2?

There are a LOT of reddit communities looking to switch over right now, and this is a COMPLETE AND TOTAL showstopper of a bug.

@RocketDerp

This comment was marked as abuse.

@th3raid0r
Copy link

I noticed that my particular issue was half pebkac and half bug.

My issue - SMTP misconfiguration on TLS (needed to be starttls instead of just tls for Protonmail)

When this type of misconfiguration occurs, it appears that it's creating stub user that isn't rolled back after failure. So when the issue is resolved, any further attempts to create the user run into constraint issues since the user is half created.

So I think the bug here is that user creation needs to roll back on SMTP issues when email verification is enabled.

@AndydeCleyre
Copy link

AndydeCleyre commented Jun 13, 2023

I've been trying to sign up to various instances, and always get the infinite hanging. I think it's this issue. For now, is there a quick and dirty way to check if a username is available, to help with the sign up process?

EDIT: I guess visiting INSTANCE/u/USERNAME works

@dev0T
Copy link

dev0T commented Jun 16, 2023

Hi! I've been attempting to register the past few days and I also get stick in the loading state forever. I tried multiple usernames but no feedback on what's going on whatsoever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants