Zapper clone || when i try to fetch tokens of big address my server will crash

usually when i put normal address which is poodle token address, i got nice response. but when i add big address which have multiple tokens i get error and my server will crash WHY?? please response fast i am working on zapper clone thats my project for internship.

what error are you getting?

i am passing 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 this address of vitalik.eth :sweat_smile: and when i run my server to fetch tokens it got crash

and for code reference this is my code
// -----------------------DISPLAY USER’S TOKENS AND FILTERING TOKENS-----------------------------

const token_Balances = () => {

app.get("/tokenBalances", async (req, res) => {

try {

  await Moralis.start({

    apiKey: process.env.MORALIS_API_KEY,

  });

  const { address, chain } = req.query;

  const response = await Moralis.EvmApi.token.getWalletTokenBalances({

    chain: chain,

    address: address,

  });

  // console.log("-------------RESPONSE---------------");

  // console.log(response.raw);

  // res.send(response);

  // ---------------FILTER SCAM TOKENS-----------------

  let tokens = response.raw;

  let legitTokens = [];

  // starting the loop with 0 to the token length

  for (let i = 0; i < tokens.length; i++) {

    const priceResponse = await Moralis.EvmApi.token.getTokenPrice({

      address: tokens[i].token_address,

      chain: chain,

    });

    // if tokens usdprice is greater than 0.01 then push it to legittoken array

    if (priceResponse.raw.usdPrice > 0.01) {

      tokens[i].usd = priceResponse.raw.usdPrice;

      legitTokens.push(tokens[i]);

    } else {

      console.log("πŸ’© Coin");

    }

  }

  res.send(legitTokens);

  console.log("Token balances is Running");      

} catch (e) {

  console.error(e);

  res.send(e);

}

});

};

token_Balances();

Hi @Web3Kid

Can you try adding some console.logs or try catch to know which line is causing the error?

Since the error is happening only with 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 address, try logging the API response to know if correct data is received from the API.