I keep receiving this error: Cannot destructure property ‘blockhash’ of ‘(intermediate value)’ as it is undefined

This is the code in question. Anyone know how i can fix this?

// Function to send transaction
async function sendTransaction(transaction) {
  try {
    transaction.feePayer = wallet.publicKey;
    const { blockhash, lastValidBlockHeight } = await rateLimitedRequest(() => connection.getLatestBlockhash({
      commitment: 'confirmed',
    }));
    transaction.recentBlockhash = blockhash;
    transaction.lastValidBlockHeight = lastValidBlockHeight;
    transaction.sign(wallet);
    const signature = await rateLimitedRequest(() => connection.sendRawTransaction(transaction.serialize()));
    await connection.confirmTransaction({
      signature,
      blockhash,
      lastValidBlockHeight,
    });
    logger.info(`Transaction sent with signature: ${signature}`);
  } catch (error) {
    logger.error(`Error sending transaction: ${error.message}`);
  }
}

I havent found a solution for this