Stytch creating multiple users with the same email

Steps to reproduce:

  1. Deleted all Stytch users and populated an environment with users using a the script below
  2. At this point, all users in Stytch had been created with today’s date
  3. Attempted log-in using a user that exists in Stytch
  4. Received an email about “creation request”
  5. Did not click on the link. Went straight to User Management console, and there are two users with the given email. The new user is backdated, maybe to the first date I used that email to login using Stytch.

This looks to me like a bug with Stytch. But maybe I am making the wrong assumptions? Happy to provide details about the environment / user in private if it helps debugging

Note: this does not happen all of the time. There is a non-deterministic element to it.

Migration script:


with open('/tmp/users.csv') as csvfile:
    csvreader = csv.reader(csvfile)
    # skip header
    next(csvreader)

    for row in csvreader:
        name = row[0]
        email = row[1]
        names = name.split(" ")
        first_name = names[0]
        last_name = ' '.join(names[1:])

        stytch_name = Name()
        stytch_name.first_name = first_name
        stytch_name.last_name = last_name
        print(
            f"Creating first_name={first_name}, last_name={last_name}, email={email}")
        try:
            client.users.create(email=email, name=stytch_name,
                                create_user_as_pending=False)
        except StytchError as error:
            # Handle Stytch errors here
            if error.details.error_type == "duplicate_email":
                # hopefully does not happen in prod
                print(
                    f"Duplicate email (caused by case sensitivity in older versions of our apps) first_name={first_name}, last_name={last_name}, email={email}")

Hey Sami – thanks for posting!

It does seem unexpected for two Users to be created with the same email address, and at first glance, I haven’t noticed any issues with your migration script.

Would you mind sending over the two user_ids that share an email address? If you’d prefer not to post them here, feel free to send them to support@stytch.com, and we’ll be happy to investigate!

Thanks for the reply.
Sent followup email to support@

Hey Sami – thanks for the additional information! I was able to reproduce this behavior, and I’ve flagged it for our engineering team. We’d only expect one user per email address to be active in this situation.

I’ll let you know here as soon as I receive any updates from our team regarding a resolution. Thanks so much for flagging this!

1 Like

Hi Nicole,

Thanks for flagging this for the engineering team.

Does the engineering date have an estimate date for the fix?

Thanks,
Sami

Hey Sami,

Sorry about the delayed response here!

Our team has rolled out a fix for the underlying issue which caused these duplicate users, and there shouldn’t be any more created moving forward.

We also went through and remediated most of the existing duplicate users (a very small number of users were ultimately affected), but there are still a small set of duplicates which are in a strange state (specifically, duplicate users with differing statuses).

Of the examples you provided in your separate email to support@stytch.com, the first set of user_ids seems to be in this state (one is pending and another is active). Our team is thinking through how to best remediate this set of users, but in the interim, issuing a Delete User request on your end for one of the two user_id s in this state should do the trick, and no further duplicate users will be created.

Please let us know if you have any further questions about this, or if you see any other strange behavior!

Thanks for the update!

Of course!

Let us know if there is anything else we can help with or if you have any other questions about this!