MetaData token_uri exists but no metadata is populated in the

I have an ERC 1155 Contract created with a URI function set like this:

    function uri(uint256 _tokenId) public pure override returns (string memory) {
        return string(
            abi.encodePacked(
                "https://jordashtalon.github.io/LimitlessFlightNFTs/Generated/",
                Strings.toString(_tokenId),
                ".json"
            )
        );
    }

That seems to work fine, when I mint a token of id 1 it mints the token great, and the metadata json url exists. However I call this function in my javascript on the frontend:

let NFTs = await Moralis.Web3API.token.getAllTokenIds({address: this.$config.contract_address, chain: this.$config.chain});
console.log(NFTs.result, 'NFT Data');

The NFT response looks like this:

[{
amount: "1"
block_number_minted: "10750594"
contract_type: "ERC1155"
last_metadata_sync: null
last_token_uri_sync: "2022-05-27T18:41:06.790Z"
metadata: null
name: "Jump Suit"
symbol: "SUIT"
synced_at: null
token_address: "0x090dc9e47e674770daf3e7ed37c78f221fd059bc"
token_hash: "b1f97aa4f541ee01c77caa80a06985ce"
token_id: "1"
token_uri: "https://jordashtalon.github.io/LimitlessFlightNFTs/Generated/1.json"
}]

The token_uri appears to be setup correctly and goes to a live url, however the metadata itself is null without any of the metadata set and I can’t figure out why.

You can try to use resyncMetadata endpoint to see if it will set the metadata

That seemed to work, is there a way to do it on an entire contract at once?

there isn’t a way to do it on an entire contract directly, if you access the nfts now then they will be added to a queue in order to resync the metadata automatically

Ok got it, I guess I could add a ReSync Button and the individual users can trigger it themselves.

1 Like

OpenSea does that as well where you can refresh metadata on each NFT, so that is a fine option.

1 Like