invalid email

default discord avatar
ativeretalbe
6 months ago
3

not sure what is the problem here. I can add the first one, but this error show up trying to create another

  • default discord avatar
    Britik
    6 months ago

    it can happens to me sometimes, i just had to refresh the tab

  • default discord avatar
    Bakry
    6 months ago

    same

  • default discord avatar
    Jarrod
    6 months ago

    @ativeretalbe You likely created the collection with

    auth: true

    and then later changed it to false.



    TLDR; delete the email index from your collection in mongodb.



    The reason this happens is bc

    auth: true

    adds the field

    email

    behind the scenes, this field is created with a unique index. Payload will not remove old indexes, you will have to do that manually.



    The reason you can create 1 user, is because they have no email, then the second user creation is attempted with the same blank email, not unique and it fails. Delete the index on the email field in mongodb and it should resolve your issues.

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.