Algorand Scheduling Transactions for Sending in the Future

I am trying to workout this course : https://developer.algorand.org/tutorials/scheduling-transactions-for-sending-in-the-future/ After all changes in the codes were changed as per my inputs, The transaction of sign is printed in console but after the time comes to the transaction it is throwing error : POST https://api.testnet.algoexplorer.io/v2/transactions 400 (anonymous) @ schedule.html:100 setTimeout (async) (anonymous) @ schedule.html:100 Promise.then (async) (anonymous) @ schedule.html:55 schedule.html:109 {message: 'txgroup had 0 in fees, which is less than the minimum 1 * 1000'} message: "txgroup had 0 in fees, which is less than the minimum 1 * 1000" [[Prototype]]: Object constructor: ƒ Object() hasOwnProperty: ƒ hasOwnProperty() isPrototypeOf: ƒ isPrototypeOf() propertyIsEnumerable: ƒ propertyIsEnumerable() toLocaleString: ƒ toLocaleString() toString: ƒ toString() valueOf: ƒ valueOf() __defineGetter__: ƒ __defineGetter__() __defineSetter__: ƒ __defineSetter__() __lookupGetter__: ƒ __lookupGetter__() __lookupSetter__: ƒ __lookupSetter__() __proto__: (...) get __proto__: ƒ __proto__() set __proto__: ƒ __proto__()

The code in the course where the error occurs :

setTimeout (()=> {    fetch(posturl, {
      method: 'POST', // or 'PUT'
       headers: {
        'Content-Type': 'application/x-binary',
       },
       body: signedTxn,
     })
     .then(response => response.json())
     .then(data => {
       console.log(data);

     })
     .catch((error) => {
       console.error('Error:', error);
     });

    }, timeOutTime );

The error is:

txgroup had 0 in fees, which is less than the minimum 1 * 1000

which seems to indicate that the fee is not set properly.
It should be at least 1000 microAlgos.

Can you show the code used to generate the transaction?

var mnemonic = "wood clump category carpet cabin cement joy cover this hour armor twist write trade term only label later lizard disease boil pelican dish ability this";

// get account from the mnemonic phrase
let account = algosdk.mnemonicToSecretKey(mnemonic);

//get the address from the mnemonic phrase
address = account.addr;

//set the urls for retrieving params and posting to the algorand blockchain

const getParamsURL = "https://api.testnet.algoexplorer.io/v2/transactions/params";

const posturl = "https://api.testnet.algoexplorer.io/v2/transactions";

//Function to GET and POST transactions

    function getvals(fetchOption, url){

        return fetch(url,
        {
            method: fetchOption,
          headers: {
            'Content-Type': 'application/x-binary',
          },
        })
        .then((response) => response.json())
        .then((responseData) => {

          return responseData;
        })
        .catch(error => console.warn(error));
      }

      // get the different in time between the future dateTime and now. 

// Change the date to a future date you prefer. It takes about 1:15 mins to complete the 1000 block rounds

    var futureTrxDate = "23 September 2021 12:29 UTC";
    var a = new Date(futureTrxDate);
    b = new Date();

   var diff_seconds = Math.abs(Math.round(((+b - +a) / 1000)));

    var blockRound = Math.abs(Math.round(diff_seconds/4.5));

    // get the parameters of the current block round
         fetchOption = "GET";
          url = "https://api.testnet.algoexplorer.io/v2/transactions/params";
      getvals(fetchOption,url).then(response=> {

        // get the last round of the current block, genesis id and genesis hash

        lastRound = response["last-round"];
        genesisID = response["genesis-id"];
        genesisHash = response["genesis-hash"]


        // get the first round of the future transaction date by adding the current last round to the future block round

        firstRoundFuture = lastRound + blockRound;

        // get the last round of the future transaction.
        // This is to make sure our transaction is
        // submitted even if there is a delay. 
        // Add 1000 round to the first round

        lastRoundFuture = firstRoundFuture + 1000;

                // I realised the the Algorand genesis hash and
        // genesid ID don't change. So you can statically 
        //declare those
   let fee = 1000;
  let suggestedParams = {
       "flatFee": true,
       "fee": response.fee,
       "firstRound": firstRoundFuture,
       "lastRound": lastRoundFuture,
       "genesisID": genesisID,
       "genesisHash": genesisHash,
   };

// get the transaction details from the constants declared //for the future transaction

      var futureRecipient = "6NGU52ZU3XPRH5QJFBFG62H3FNGGGOHOSP462RICAFZCKII56ZMYEFV5UU";
       var amount = 1000000;
       var note =  algosdk.encodeObj("Invoice payment");
           timeOutTime = diff_seconds*1000;

  let txn = algosdk.makePaymentTxnWithSuggestedParams(address, futureRecipient, amount, undefined, note, suggestedParams);
     let signedTxn = txn.signTxn(account.sk);
     console.log(signedTxn);
     console.log("SignTxn")
    setTimeout (()=> {    fetch(posturl, {
      method: 'POST', // or 'PUT'
       headers: {
        'Content-Type': 'application/x-binary',
       },
       body: signedTxn,
     })
     .then(response => response.json())
     .then(data => {
       console.log(data);

     })
     .catch((error) => {
       console.error('Error:', error);
     });

    }, timeOutTime );


    });

(edited post to keep the code inside triple backquotes ``` for clarity)