AxiosError: Internal Server Error code 500

Hi I keep getting the following error when attempting to get /api/moralis/evmApi/getWalletTokenBalances. I am not sure what the issue is but here is my code.

const { fetch: call, data: balances } = useEvmWalletTokenBalances()

 useEffect(() => {
    if (addr) {
      call({ address: addr, chain: sepolia })
    }
    console.log(balances)
  }, [addr])

I have checked that both addr and sepolia are valid constants.

I have tried changing the api key as well to no avail

not born yesterday “Bryan” lol

1 Like

Hi @CleanMcGerk

You get an internal server error when there is an unhandled error in your code. Can you try wrapping your related server code with try catch and log the error? It will give more details on the issue.

The code hasn’t changed and was working a month ago not sure if there’s been an update I might have missed.

however here is my code.

const login = async () => {
    const { account, chain } = await connectAsync({
      connector: new MetaMaskConnector(),
    });
    const userData = { address: account, chainId: chain.id };
    console.log(userData)

    
      setAddy(account)
      const { fetch: call, data: balances } = useEvmWalletTokenBalances()

     useEffect(() => {
    if (addr) {
      try {
        console.log("trying")
        call({ address: addr, chain: sepolia })
      }
      catch {
        console.log(error)
      }
   

    }
    console.log(balances)
  }, [addr])
  };

and I get the error

managed to solve it by clearing my cache. Seems to have been a change in location (IP address) error

Glad it is working now. But cache and IP does not have any relation🤔