I am using Metamask with my first account and I logged in successfully using:
user = await Moralis.Web3.authenticate();
But, when I switch to my second Metamask account I get the following error although there is only one line in the “User” database which is my first Metamask account. With my second one I get the following error:
moralis.js:21595 POST https://luoljbifa2qa.moralis.io:2053/server/users 400 (Bad Request)
main.js:111 Error: A duplicate value for a field with unique values was provided
at handleError (moralis.js:21728)
Actually I only provide a different username with the second Metamask address, but this does not work. Did you see this error before? Is the database somehow corrupted? I can also delete all automatically created lines in the “User” database (excluding the first Metamask account) but the issue does not disappear.
Hey @CryptoTabaluga, did you disconnect the first account before switching from the 2nd one? you could also try deleing the entire user data, to start from the beginning, might be useful to check your code…
Hi ! Yes, I disconnected the first account and then I reload the whole page and then I connect the new account, but I still get the error… the only thing I did not try out is deleting the whole “User” database, because I might end up with deleting the server and re-installing it, because I am not able to login in with any account, but I think this might be what I need to do…hmm
Now it is really bad… I deleted all rows within “User” and I get the same error for all my accounts now including my first Metamask account - although the User class is empty… not able to log in anymore with no account… Do I have to install everything again ? Because I implemented all the classes and the event listener plugins etc…
@thecil I found the answer in another post… It is quite a weird issue…
Amazing, although moralis is working very nice, is still on constant develop, so it’s normal to find bugs with weird solutions.