Metadata not updating

Moralis metadata of the NFT isn’t updating for some reason, How do I fix it? I want to resync 4 contracts with 500 NFTs each.
It returns this metadata (https://gateway.moralisipfs.com/ipfs/QmaDNdLLUAW41YK6YNgVxZ3HvHWxj9JvNN6Kb8CoC7JBa7/kergom.json):

{
    "name": "Mysterious Mace",
    "description": "A Mysterious Mace has been found! It's identity will uncover itself soon!",
    "image": "ipfs://QmSCar92romEm5CkJQpgosW2Rj6VUHvD2WeepJN4944yET/kergom.gif",
    "attributes": [
      {
        "trait_type": "Mace",
        "value": "Mystery"
      }
    ]
    }

But it should be like this (https://gateway.pinata.cloud/ipfs/QmThvqeg5AX2e5tuCzCwCoREWequf4TjvsHatWHoSuE2H1/20.json):

{
    "name": "Kërgom",
    "description": "The Kërgom was developed around the time the Granvalden Kingdom began to fracture. As far as we know, it was the first, and remains the only mace that both bludgeons and cleaves in the Upper Lands. While considered to be unseemly by most it has become a pillar among the suits of Reinboldt.",
    "image": "ipfs://QmbaMGjwwzxvPFpNGngmFvdbVMqjkyg6Br4BiN2eNBpbVu/1.png",
    "animation_url": "ipfs://QmSY9pQqe3EVK3uDWGbDpNnVKq2SU7F3JvMw8KQbknz7ko/1.glb",
    "attributes": [
      {
        "trait_type": "House",
        "value": "Reinboldt"
      },

      {
        "trait_type": "Type",
        "value": "Mace"
      },
      
      {
        "trait_type": "Rarity",
        "value": "Standard"
      },

      {
        "trait_type": "Edition",
        "value": "First Edition"
      }
    ]
    }

Hi,
Can you also paste the chain, contract address, token id?

You can try to use resync metadata endpoint with uri flag. You can do it directly from web3api interface too: https://admin.moralis.io/web3Api

Chain: “eth”
Contract Address: 0xA958fd55Be008BE82595939646d37B5Ca4Fe778D
Token ID: (1-500)

I also tried that but still nothing. I want to resync 4 contracts in total.
Other three Contracts:

Contract 2: 0x703895bc5c3538a0eFAE736308f76d7bEDf01AfD
Tokens: 1-500

Third:

Contract 3: 0xea6cca8A0A7A9054e7695f6773476E5FAd43805b
Tokens: 1-500

Fourth:

Contract 4: 0x73C7F078DBc1D961DF33aDa0EF9caC89c7887801
Tokens: 1-500

I tried now for token id 3 and it looks like it worked as expected,
this is what I tried:

https://deep-index.moralis.io/api/v2/nft/0xA958fd55Be008BE82595939646d37B5Ca4Fe778D/3/metadata/resync?chain=eth&flag=uri&mode=sync

So How do I do it for all of them? & how long does it take to sync one?

it worked fast to sync one, you can write a script to iterate over all, I would expect it to work in up to 3 seconds for one, but you can not call that resync endpoint more than once a second.

I tried this earlier as well, I’m getting same error as before:

function resyncLoop1() {
    for (var i = 1; i <= 500; i++) {
        fetch('https://deep-index.moralis.io/api/v2/nft/0xA958fd55Be008BE82595939646d37B5Ca4Fe778D/' + i + '/metadata/resync?chain=eth&flag=uri&mode=sync', {
            headers: {
                'accept': 'application/json',
                'X-API-Key': '3213'
            }
        });
        console.log('Contract 1: ' + i);
        setTimeout(function() {}, 3000);
    }
    for (var i = 1; i <= 500; i++) {
        fetch('https://deep-index.moralis.io/api/v2/nft/0x703895bc5c3538a0eFAE736308f76d7bEDf01AfD/' + i + '/metadata/resync?chain=eth&flag=uri&mode=sync', {
            headers: {
                'accept': 'application/json',
                'X-API-Key': '3213'
            }
        });
        console.log('Contract 2: ' + i);
        setTimeout(function() {}, 3000);
    }

    for (var i = 1; i <= 500; i++) {
        fetch('https://deep-index.moralis.io/api/v2/nft/0xea6cca8A0A7A9054e7695f6773476E5FAd43805b/' + i + '/metadata/resync?chain=eth&flag=uri&mode=sync', {
            headers: {
                'accept': 'application/json',
                'X-API-Key': '3213'
            }
        });
        console.log('Contract 3: ' + i);
        setTimeout(function() {}, 3000);
    }

    for (var i = 1; i <= 500; i++) {
        fetch('https://deep-index.moralis.io/api/v2/nft/0x73C7F078DBc1D961DF33aDa0EF9caC89c7887801/' + i + '/metadata/resync?chain=eth&flag=uri&mode=sync', {
            headers: {
                'accept': 'application/json',
                'X-API-Key': '312313'
            }
        });

        console.log('Contract 4: ' + i);
        setTimeout(function() {}, 3000);
    }
}
resyncLoop1();

Screenshot 2022-04-26 223458

try to sync one token id first from code, to make sure that it works, then try to add for, and the rest

you can try to use axios if fetch doesn’t work

1 Like

Error was due to resource allocation, but it’s working now.

1 Like

Its working now, & its updated yay!
But Do you know why it sometimes return this error:
image

it looks like that token id 39 was not minted yet and it doesn’t exist now

1 Like

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

1 Like

What’s the ETA for the rest of endpoints to auto update?
e.g. /{address}/nft

for that particular endpoint for now it works only if the token_uri points to an IPFS url and if metadata was not updated recently

Ok cool. Ya it points to an IPFS url and yet it doesn’t seem to be updating. Could it be cause its a custom domain? By recently you mean the 10 mins it was mentioned?

what is the particular case that you have with an IPFS url that doesn’t update?