Error Making a TestNet transaction on Algorand Network with JavaScript

I am facing an error when I attempt to run my code which is supposed to transfer algos to another account with JavaScript:

Code Sample Below:

// Algorand Algod (v2) example 
// Send transaction on TestNet

const algosdk = require('algosdk');
const baseServer = "https://testnet-algorand.api.purestake.io/ps2";
const port = "";

const token = {
    'X-API-key' : 'B3SU4KcVKi94Jap2VXkK83xx38bsv95K5UZm2lab',
}

let algodClient = new algosdk.Algodv2(token, baseServer, port);

(async() => {

    let params = await algodClient.getTransactionParams().do();
    
    let amount = Math.floor(Math.random() * 1000);
    var mnemonic = "code thrive mouse code badge example pride stereo sell viable adjust planet text close erupt embrace nature upon february weekend humble surprise shrug absorb faint"; 
    var recoveredAccount = algosdk.mnemonicToSecretKey(mnemonic); 
    
    let txn = {
        "from": recoveredAccount.addr,
        "to": "UUOB7ZC2IEE4A7JO4WY4TXKXWDFNATM43TL73IZRAFIFFOE6ORPKC7Q62E",
        "fee": 1,
        "amount": amount,
        "firstRound": params.firstRound,
        "lastRound": params.lastRound,
        "genesisID": params.genesisID,
        "genesisHash": params.genesisHash,
        "note": new Uint8Array(0),
    };

    let signedTxn = algosdk.signTransaction(txn, recoveredAccount.sk);
    let sendTx = await algodClient.sendRawTransaction(signedTxn.blob).do();

    console.log("Transaction : " + sendTx.txId);
})().catch(e => {
    console.log(e);
}); 

The error I get when I try to run the code

Please how to resolve it and what could be causing it.

I ran the exact code as above and have no issue.

Do you have a firewall / proxy / antivirus on your network or on your computer?
Can you try to run in the terminal:

curl -X GET "https://testnet-algorand.api.purestake.io/ps2/v2/status" -H "x-api-key:YYYY"

replacing YYYY by your API key.

PS 1: Writing your PureStake key in a public post allows anyone to use it and then block you by making too many queries.

PS 2: I’ve added triple backquotes ``` around your code to improve readability.