Web3js (Provided address undefined is invalid)

I am trying to send a transaction with web3js on Polygon mainnet(it uses EVM), but anyways seems to be a problem in the code somewhere.

I get an error

node_modules/web3-core-helpers/lib/formatters.js:403
throw new Error(Provided address ${address} is invalid, the capitalization checksum test failed, or it's an indirect IBAN address which can't be converted.);
^

Error: Provided address undefined is invalid, the capitalization checksum test failed, or it’s an indirect IBAN address which can’t be converted.

link to web3js
https://web3js.readthedocs.io/en/v1.3.4/web3-eth.html#sendtransaction

const Web3 = require(‘web3’)
const Tx = require(‘ethereumjs-tx’).Transaction

// connect to Infura node
const web3 = new Web3(new Web3.providers.HttpProvider('https://polygon-mainnet.infura.io/v3/d3c3c1a3599b4d7a8b294becXXXXXXXX'))

// the address that will send the test transaction
const address = '0x377D1F70614B2FEF2F371C2D9BA2faBXXXXXXX'
const privateKey = new Buffer('af6dc00a74882c020fff852fb2458c30cXXXXXXXX', 'hex')

// the destination address
const toAddress = '0x789C093331b59C6b1Ca99783D308684EXXXXXXXX'

// construct the transaction data
// NOTE: property 'nonce' must be merged in from web3.eth.getTransactionCount 
// before the transaction data is passed to new Tx(); see sendRawTransaction below.
web3.eth.getTransactionCount(this.address).then(txCount => {
        const txData = {
          nonce: web3.utils.toHex(txCount),
          gasLimit: web3.utils.toHex(100000),
          gasPrice: web3.utils.toHex( 1), // 10-15 gwei should be ok
          to: this.toAddress,
          from: this.address,
          value: web3.utils.toHex(
            web3.utils.toWei("0.0001", "eth")  // amount you want to send
          )
        };

       const transaction = new Tx(rawTx); //transaction = new Tx(txData, {'chain':'mainnet'});
        transaction.sign(
          new Buffer(this.account.privateKey.substring(2), "hex")  // remove .substring(2) if you get errors
        );
        var self = this;
        web3.eth
          .sendSignedTransaction("0x" + transaction.serialize().toString("hex"))
          .on("transactionHash", function(txHash) {
            // show tx hash ?
          })
          .on("receipt", function(receipt) {
            console.log("receipt:" + receipt);
          })
          .on("confirmation", function(confirmationNumber, receipt) {
            if (confirmationNumber >= 1) {
              // message that tx went ok
            }
          })
          .on("error", function(error) {
            console.log("error sending ETH", error);
          });
      });

I’ve entered correct addresses, but i have no clue what the problem is…anyone nows for a possible solution?

It seems like your contract address is not right, I think you can use this method to make a checksum address: web3.utils.toChecksumAddress()