[SOLVED] Moralis is not fetching the name or image field from metadata

okay thanks let me have a look :raised_hands:

gotcha thanks just tested this guys :raised_hands: seems like thereโ€™s an issue if you try to resync with uri, but with metadata it works

@purplecomet1 @ibn5x alright guys, turns out thereโ€™s some mistake on the docs here :raised_hands: so I fixed it.

The uri is only to resync the URI~

https://docs.moralis.io/moralis-server/web3-sdk/token#resyncmetadata

1 Like

still not resyncing metadata with resync metadata

Really? I tried resync your metadata works all fine?

how does your code look like?

        const options = {address: CONTRACT_ADDRESS, chain: "polygon"}; 
        let NFTs = await Moralis.Web3API.token.getAllTokenIds(options);
        let counter = NFTs.result.length;
        let syncedHomies = [];
        let syncedMetadata = [];
  
  
        for(let x = 0; x < counter; x++){
          const obj = JSON.parse(NFTs.result[x].metadata);  
          syncedMetadata.push(obj); 
          syncedHomies.push(NFTs.result[x]);
         
         
        }

so are synced some are not

you have an example of what token id that doesnโ€™t have the metadata synced after you tried to resync it? also if you could specify the contract address

nearly all the tokens have null as the metadata when calling from web3API within the Moralis dashboard. token id 300 for example still shows null as do a majority

contract address : 0x462D73B9925C73Abf030f814E71C363A34BC5aA3

I get this:

{
  "token_address": "0x462d73b9925c73abf030f814e71c363a34bc5aa3",
  "token_id": "300",
  "block_number_minted": "24868037",
  "owner_of": "0xd186a3323f96a050ae6f100233d032423a737ee7",
  "block_number": "24868037",
  "amount": "1",
  "contract_type": "ERC721",
  "name": "CryptoHomeBoyz",
  "symbol": "CHBZ",
  "token_uri": "QmVaZV42TJ9CB3Jw1UdM5wgKUjLxBWZvxcUWHomJFhumbo",
  "metadata": null,
  "synced_at": "2022-02-16T15:16:30.259Z",
  "is_valid": 0,
  "syncing": 2,
  "frozen": 0
}

that token_uri is the expected one?

no, I had to update the ur after deploying, that is not the expected one. Now same contract different id for example id: 1 produces full metadata, after resync. but not id 300 or a majority of others.

here token id 1:

{
  "token_address": "0x462d73b9925c73abf030f814e71c363a34bc5aa3",
  "token_id": "1",
  "block_number_minted": "24867755",
  "owner_of": "0x7d9bf3365bb22e60a4e1397c2c38fd695b6d824a",
  "block_number": "24932649",
  "amount": "1",
  "contract_type": "ERC721",
  "name": "CryptoHomeBoyz",
  "symbol": "CHBZ",
  "token_uri": "https://ipfs.moralis.io:2053/ipfs/QmVaZV42TJ9CB3Jw1UdM5wgKUjLxBWZvxcUWHomJFhumbo/hidden.json",
  "metadata": "{\n  \"name\": \"CryptoHomeBoyz #1\",\n  \"description\": \"CryptoHomeBoyz (Design hidden) | 3,333 | Memp City Native | CryptoHomeBoyz is a generative utility NFT collection of 3,333 unique pieces. First Generation holders are white-listed and own one block lot within the city. The CHB collection will initialize Memp Cities' first Body of Government. CryptoHomeBoyz with a County Seal will be the Memp City's first democratically elected congress body.\",\n  \"image\": \"ipfs://QmRhcXZMfropRFXVF5KMHbiaLyeUaYetnRRT6KXDdKPrmV/hidden.png\",\n  \"developers\": \"Suns Of DeFi\"\n}",
  "synced_at": "2022-02-13T22:34:55.280Z",
  "is_valid": 1,
  "syncing": 2,
  "frozen": 0
}```

I think that you have to resync to token uri first, token_uri looks different here for token id 1

1 Like

thank you, I will. On it.

Go ahead and close it out! @cryptokid strikes again! Thank you for the assistance, you are indeed correct all synced.

1 Like