Moralis Authenticate metamask works on Local server but wont work on Live server

This Code runs well on my Local Server but once I build and upload it to my Live sever The await authenticate() function doesn’t seem to work anymore. Am I missing something?

const { authenticate, isWeb3Enabled ,isAuthenticated, isAuthenticating, user, enableWeb3, Moralis, logout } = useMoralis();
  const [currentAccount, setCurrentAccount] = useState();
  const [balance, setBalance] = useState(0);

  const login = async () => {
    if (!isAuthenticated) {
      await authenticate({provider: "metamask" })
      .then(function (user) {
        console.log("logged in user:", user);
        console.log(user.get("ethAddress"));
        setCurrentAccount(user.get("ethAddress"))
      })
      .catch(function (error) {
        console.log(error);
      });
    }
  }

  const logOut = async () => {
    await logout();
    console.log("logged out");
  }```

Do you get any errors in your console? How is the login function called in this component? E.g. with a button?

Also you don’t need the use of async and wait if you’re using then.

No Error with the button, Infact It loads the console.log within the login() function. You can check the webpage. Vite App (kryptswap.com)

I’m getting an error of Right-hand side of 'instanceof' is not callable and I see you’re using Vite; other users have reported a similar issue when deploying.

Can you please look through these two topics:

Error in production in vue, TypeError: Right-hand side of ‘instanceof’ is not callable - Moralis Forum

Vite + React production build error: TypeError: Right-hand side of ‘instanceof’ is not callable · Issue #228 · MoralisWeb3/react-moralis (github.com)

Thanks Mate, Would Try and get back to you