IntegrityError: duplicate key value violates unique constraint "contentcuration_user_email_key"
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
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¬ification_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)
Supporting @akolson on this. Self-assigning myself.