Using useMoralis() to authenticate, randomly one in 10 users cannot authenticate

Having a weird issue where 90% of users are fine authenticating using the code below, but it doesn’t work 1 in 10 tries (roughly, it is seemingly random so far, and i cannot pin down why – browsers and devices are more or less consistent. When it doesn’t work it adds the following a bunch of times into the Users table of Moralis’ backend (undefined many times over, one undefined row for each time a user tries to authenticate)…

Code being used for auth below:

const { isWeb3Enabled, enableWeb3, isAuthenticated, isWeb3EnableLoading } =
    useMoralis();

  useEffect(() => {
    const connectorId = window.localStorage.getItem("connectorId");
    if (!isAuthenticated && !isWeb3Enabled && !isWeb3EnableLoading) {
      enableWeb3({ provider: connectorId });
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [isAuthenticated, isWeb3Enabled]);

I don’t see the authentication part in that code

for the users that it fails, it fails consistently, or sometimes it fails and sometimes it works for same users?

It fails all the time for the same user(s). The authentication is done via the boilerplate code i believe (inside useMoralis() where it then shows the user the modal below)…

maybe it is an issue with those users in particular, if you could check in network tab for errors, or in server logs for logs

If you are using this then, you need to set props moralisAuth={true} for the WalletModal component from web3uikit to authenticate with the Moralis server using authenticate function, otherwise it just connects you with Metamask with enableWeb3 function under the hood

@YosephKS the folks it is failing for are using metamask to begin with, does that make a difference with your suggestion above?

Here’s a video in real-time with it failing for someone – https://www.loom.com/share/fb40fe875be342f3993737d7517adb91

when it is failing, any error in the network tab?