Error while getting NFT's

I am seeing the below error while running getnft function, however, the same error disappears while I run the code again.
What is this error related to?


GetNFT = async() => {

        web3 = await Moralis.enableWeb3()
        const loggedUserAdd = (await web3.eth.getAccounts())[0]

    // const loggedUserAdd = (await web3.eth.getAccounts())[0]
    console.log("Getting NFT's")
    const ethNFT = await Moralis.Web3API.account.getNFTs({chain:"rinkeby"});

    if (ethNFT.result.length >0) {
        let maxNFTprice=0;
                metadata = JSON.parse(n.metadata);
                let x = metadata.fiatPrice.slice(1,metadata.fiatPrice.length).replace(",","")
                maxNFTprice += parseFloat(x);
                let content = `
                <img src="${fixURL(metadata.image)}" class="NFTView" id="Most Valued NFT Image" alt="Crypto Kitty"/>
                <span class="NormalText Listaddress">
                <span class=""></span>
            <span class="NormalText Listaddress">${metadata.description}</span><span class="NormalText Listaddress">${metadata.fiatPrice}</span>
            document.getElementById('Most Valued NFT').innerHTML+= content;
        document.getElementById('NFTCount').innerHTML+= `
        <span class="NormalText Listaddress">
                                            <span class=""></span>

        <span class="NormalText Listaddress">
                                            <span class=""></span>


We will need to investigate, last error seems to be from 25 minutes ago.

you can try to update your Moralis Server in case that you don’t have the latest version (0.0.279 now)

I updated the server and tried again and the error appeared twice or thrice, then it disappeared.

It again appeared after sometime. (i made no change in the code)

Ok, we’ll have to look, it doesn’t look like something that can be fixed from your code.

1 Like

Can you paste the exact parameters that you use for getNFTs when you get that error (address and chain)?
Now I noticed that you also try some web3api queries with local devchain and those queries will not work.

I am using the below code with parameter and the address is 0xCC072A19678534e25D5636d229E3680603E46221 which has 2 NFT’s on rinkeby.

await Moralis.Web3API.account.getNFTs({chain:"rinkeby"})

If you execute this in your browser console 20 times you get error from time to time?

x = await Moralis.Web3API.account.getNFTs({chain:“rinkeby”, address: “0xCC072A19678534e25D5636d229E3680603E46221”})

tried it more that 30 times just now, haven’t received any error

ok, maybe you were receiving that error for different parameters then?

maybe you were executing that code when you were not authenticated, and maybe the address was not set
also, what version of Moralis SDK are you using?
asking because I get an error like this when no address is provided:

{code: 141, error: 'Error: required param address not provided'}

maybe you were executing that code when you were not authenticated, and maybe the address was not set
I am using a similar function to get balances and transactions details and they are running good, so i guess this can’t be the case.

also, what version of Moralis SDK are you using?

I have 0.0.95 for Moralis SDK, but I don’t think that it matters.

Any idea how to replicate that error?

I was able to replicate your error when I was not authenticated.

I don’t know exactly how to reproduce it now, it looks like it wasn’t because I was not authenticated

hmm ok.

Even I tried to reproduce it but was not successful.

I get that error from time to time, rarely, it looks random.