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

Exception openedx.tasks.repair_faulty_openedx_users #1769

Closed
sentry-io bot opened this issue Jul 21, 2023 · 1 comment
Closed

Exception openedx.tasks.repair_faulty_openedx_users #1769

sentry-io bot opened this issue Jul 21, 2023 · 1 comment
Assignees

Comments

@sentry-io
Copy link

sentry-io bot commented Jul 21, 2023

Two things:

  1. Can we make this stop?
  2. Can we improve the Exception message?

Sentry Issue: MITXONLINE-2PD

OpenEdxUserCreateError: Error creating Open edX user. Response - code: 400, content: {
  "name": [
    {
      "user_message": "Enter a valid name"
    }
  ],
  "error_code": "validation-error"
}
  File "openedx/api.py", line 353, in repair_faulty_edx_user
    created_user = create_edx_user(user)
  File "openedx/api.py", line 145, in create_edx_user
    raise OpenEdxUserCreateError(

Exception: 
  File "openedx/api.py", line 397, in repair_faulty_openedx_users
    created_user, created_auth_token = repair_faulty_edx_user(user)
  File "openedx/api.py", line 361, in repair_faulty_edx_user
    raise Exception from e

Failed to repair faulty user inspection ([email protected])
@rachellougee
Copy link
Contributor

This specific user's data has been warning for 5 month. This user was created on 2022-07-19 with Full Name containing URL (https//) on it, so it kept failing to create user on open edX because it couldn't pass the validation on name field (contains_url implemented on open edX platform)

def validate_name(name):
    """
    Verifies a Full_Name is valid, raises a ValidationError otherwise.
    Args:
        name (unicode): The name to validate.
    """
    if contains_html(name):
        raise forms.ValidationError(_('Full Name cannot contain the following characters: < >'))
    if contains_url(name):
        raise forms.ValidationError(_('Enter a valid name'))

I've updated this user's full name to match with first_name+last name from legal address, that has stopped this sentry error. I've also confirmed that this user has been created on open edx successfully.

As for the exception message, It seems to clear to me Failed to repair faulty user inspection along with Enter a valid name. Also I believe this should not happen again as we have implemented validation on name field recently (see here), there are open issues for NAME_REGEX, but users should not be able to create a account with invalid name anymore

@pdpinch FYI, it's all set. But feel free to open it if you think we should update the exception message

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

No branches or pull requests

2 participants