Issue with checking transactions


I have tried to replicate the tutorial posted here, but without success:

Here is my code:

const Web3 = require('web3');
class TransactionChecker {

    constructor(projectId, account) {

        this.web3 = new Web3(new Web3.providers.HttpProvider('' + projectId));

        this.account = account.toLowerCase();

    async checkBlock() {
        let block = await this.web3.eth.getBlock('latest');
        let number = block.number;
        console.log('Searching block ' + number);
        if (block != null && block.transactions != null) {
            for (let txHash of block.transactions) {
                let tx = await this.web3.eth.getTransaction(txHash);
                if (this.account == {
                    console.log('Transaction found on block: ' + number);
                    console.log({address: tx.from, value: this.web3.utils.fromWei(tx.value, 'ether'), timestamp: new Date()});

   let txChecker = new TransactionChecker(process.env.INFURA_ID, 'd21e93afd15342dfbbcd9459d3adca34');

setInterval(() => {
}, 15 * 1000);

But all I am getting is “Error: Invalid JSON RPC response: “invalid project id\n””. Not sure why.

Could anyone help please? I’m new to this.

Hi there @mh133 Welcome to the Infura community.

let txChecker = new TransactionChecker(process.env.INFURA_ID, 'd21e93afd15342dfbbcd9459d3adca34')

for this line here, can you help to ensure that the Infura ID is getting pulled correctly from the .env file?
Also, I noticed the account is not an ethereum address?

Hi Lily,

Thank you for your interest in my case. I haven’t set any .env, would the following page help?

Thank you!