NFT metadata is wrong

332 NFTs are returned when running this endpoint:

https://deep-index.moralis.io/api/v2/nft/0x9ada21a8bc6c33b49a089cfc1c24545d2a27cd81?chain=eth&format=decimal

However the metadata of several items are NULL. For example for NFT with Token ID 195:

{
      "token_address": "0x9ada21a8bc6c33b49a089cfc1c24545d2a27cd81",
      "token_id": "195",
      "amount": "1",
      "contract_type": "ERC721",
      "name": "Project Godjira Genesis",
      "symbol": "PGG",
      "token_uri": "https://godjira-metadata-bucket.s3.ap-south-1.amazonaws.com/195",
      "metadata": null,
      "synced_at": "2022-03-07T07:20:29.657Z"
    },

However it does have metadata. See here:

https://opensea.io/assets/0x9ada21a8bc6c33b49a089cfc1c24545d2a27cd81/195

Or examine the TokenURI:

https://godjira-metadata-bucket.s3.ap-south-1.amazonaws.com/195

This seems to be a general problem with many NFT collections queried with the Moralis API.

Resyncing it should fix it I believe.

I only use the token_uri (where that metadata originally comes from) and parse through it if I want metadata, using the returned metadata is too inconsistent.

@glad do you have any code snippet to share on all the fringe cases of parsing the metadata?

Sure; the following is an example using a response from the GetNFTs endpoint.

const metadata = response.data.result.map(async (item) => {

    const response = await axios.get(item.token_uri).catch((err) => {
      if (err.code == 'ENOTFOUND') console.log(err);
    });
   
   // metadata
   return response.data;
});

Moralis now supports refresh for all NFTs automatically Moralis Updates NFT Metadata