learningequality / studio

Content curation tools for Kolibri
https://studio.learningequality.org/
MIT License
117 stars 164 forks source link

IntegrityError: duplicate key value violates unique constraint "contentcuration_user_email_key" #4779

Open sentry-io[bot] opened 1 month ago

sentry-io[bot] commented 1 month ago

From @bjester: We should have proper defensive checks on user creation such that attempting to create a user with a duplicate email address doesn't fail and produce a 500 error. This could have come from a race condition (double submit). We should evaluate what happened and do what we can to ensure we don't get these errors.

Related to: https://learningequality.sentry.io/issues/5955562525/?alert_rule_id=478560&alert_type=issue&notification_uuid=41f27029-564a-4a93-b3cc-d7239147f02f&project=1252819&referrer=slack


Sentry Issue: STUDIO-HFD

UniqueViolation: duplicate key value violates unique constraint "contentcuration_user_email_key"
DETAIL:  Key (email)=(<redacted>) already exists.

  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "django_prometheus/db/common.py", line 69, in execute
    return super().execute(*args, **kwargs)

IntegrityError: duplicate key value violates unique constraint "contentcuration_user_email_key"
DETAIL:  Key (email)=(<redacted>) already exists.

(22 additional frame(s) were not displayed)
...
  File "contentcuration/views/users.py", line 172, in form_valid
    self.register(form)
  File "contentcuration/models.py", line 393, in save
    super(User, self).save(*args, **kwargs)
ozer550 commented 2 weeks ago

Supporting @akolson on this. Self-assigning myself.