TypeError: Cannot read property 'useMoralis' of undefined

Hey guys,

I’m trying to deploy my nextJS site on vercel and I keep getting an error after building is finished.
Everything works locally and builds without errors
here’s the error I’m getting

The thing that stumps me is I only use ‘useMoralis’ twice in my code

import { useMoralis, useNFTBalances, useNativeBalance } from "react-moralis";

// and later on

  const { authenticate, isAuthenticated, logout, enableWeb3, Moralis } =
    useMoralis();

and here’s my creation

          <MoralisProvider
            appId={process.env.NEXT_PUBLIC_APP_ID}
            serverUrl={process.env.NEXT_PUBLIC_SERVER_URL}
          >
            <Web3Block />
          </MoralisProvider>

All environment variables are properly set locally and on vercel. I used the same solution in another project.

I honestly have no idea whats going on

What line of code is that error referring to?

Does it deploy when you remove any use of useMoralis?

When you say same solution, do you mean also with using useMoralis?

Sorry,
My dev partner tried and it magically worked. pretty frustrating considering I’ve been struggling with it 5 hours but :man_shrugging: it works.