Moralis not indexing some NFTs in a contract on polygon

This is my workaround solution for now as a cloud function… seems to work. But please let me know if there is a better way.

  const address = request.user.get('ethAddress');
  const query = new Moralis.Query("PolygonNFTOwners");
  query.equalTo("owner_of", address);
  query.equalTo("token_id", "51482241612821727613098322259102395857639978124097578384027034228393947168832");
  const results = await query.find();
1 Like

Quick question - Did this issue fix itself automatically yesterday, or are there any manual steps that i can follow on my end to resolve this issue temporarily?

I think that the issue wasn’t completely fixed yesterday, I don’t think that you have to do any manual steps.

Understood. Thanks for the update!
Any rough estimates on timelines for this issue being resolved?

I don’t have an exact estimate now.

No worries, thanks for looking into the issue.

Hey! here’s some more information that may help you debug this issue -

I tried creating a new smart contract and minted 2 NFTs on it, but those aren’t showing up in the API response though. This means that the error is not limited to existing smart contracts, or just one specific smart contract. It should be a bug across all smart contracts on polygon currently.

Here’s the API call returning 0 NFTs inside the new smart contract -

curl -X 'GET' \
  'https://deep-index.moralis.io/api/v2/nft/0xDa916341A08A39f49E9B2eB0d1446723773D6A17?chain=polygon&format=decimal&order=DESC' \
  -H 'accept: application/json' \
  -H 'X-API-Key: ###'

Here are the details showing 2 tokens inside the smart contract -

Let me know if there’s any additional info i can provide to help out! :slight_smile:

I expect it to be a general problem, not only for a specific smart contract. And in particular for new smart contracts, it is also required to call GetTokenIdMetadata in order to start indexing that smart contract

1 Like

Makes sense. I tried calling GetTokenIdMetadata but that returned a similar error -
Request -

curl -X 'GET' \
  'https://deep-index.moralis.io/api/v2/nft/0xDa916341A08A39f49E9B2eB0d1446723773D6A17/1?chain=polygon&format=decimal' \
  -H 'accept: application/json' \
  -H 'X-API-Key: O2QNBNDpazmjaKqjQhNblKtmEIDHZw9i5FT6e68SxJn9dr2JVjaKHALObCw30SXu'

Response -

{
  "message": "No metadata found! Try again later"
}

This did not result in the smart contract starting indexing or the previous API response changing.

Good news! I was able to resolve this issue -

  1. Created a new contract
  2. Manually pass the new Contract address + tokenIDs to GetTokenIDMetadata.
  3. These specific tokens ids Indexed after a few mins of calling GetTokenIDMetadata
  4. The data for those specific tokenIDs from step 3 showed up inside the contract address details API a few minutes later.

Note - This worked for the new contract address I created in step 1, but not for the old one facing this problem originally.

Unfortunately, my above workaround of manually calling token/{address}/{tokenId} to get new NFTs indexed has stopped working too.

For example, here’s my new contract address -

curl -X 'GET' \
  'https://deep-index.moralis.io/api/v2/nft/0xda916341a08a39f49e9b2eb0d1446723773d6a17?chain=polygon&format=decimal&order=DESC' \
  -H 'accept: application/json' \
  -H 'X-API-Key: ###'

It returns 3 token Ids, and it seems to have stopped indexing the 4th one which was minted about 5 hours ago -

I get 3 NFTs now too with

x = await Moralis.Web3API.token.getNFTOwners({address:“0xda916341a08a39f49e9b2eb0d1446723773d6a17”, chain: “polygon”, order:“token_id.DESC”})

Yep, the contract address has 4 NFTs whereas only 3 are being returned.

Yep, it looks like there is still a problem that we have to fix it.

1 Like

So far, the only solution that is consistently working for me is deploying a new contract every time i have to mint a new NFT.

We are working on fixing this problem

1 Like

Thank you, appreciate your continuous support on this! :slight_smile:

Hey! quick update on the issue if it helps with debugging -

curl -X 'GET' \
  'https://deep-index.moralis.io/api/v2/nft/0x34326932C6b0da9004429580B5a3D27bCD3a69Ad?chain=polygon&format=decimal&order=DESC' \
  -H 'accept: application/json' \
  -H 'X-API-Key: ###'

Since about yesterday, tokens are sometimes syncing after manually calling the metadata/addressID/tokenID API but the response misses indexing the “metadata” key. Not sure if this is a related issue to the existing issue.

Related to this, the response for individual token metadata shows synced_at & metadata both as null (where as the parent contract token list API returns synced_at)

curl -X 'GET' \
  'https://deep-index.moralis.io/api/v2/nft/0x34326932C6b0da9004429580B5a3D27bCD3a69Ad/1?chain=polygon&format=decimal' \
  -H 'accept: application/json' \
  -H 'X-API-Key: ###'