Metadata missing when calling getTokenIdMetadata

Hi I try to call getTokenIdMetadata (in cloud function) for metadata but I always get metadata property as null.
here are call details:

const { metadata } = await Moralis.Web3API.token.getTokenIdMetadata({
  address: '0x090d1f489d873dd2E4a496a43094C0C354B43AD7',
  token_id: '1',
  chain: 'bsc testnet',
});

When I try to get those data on the frontend I got this error:

You need to call Parse.initialize before using Parse.

Any clue what I am doing wrong ?

1 Like

Hey @Rayshar

  1. You are trying to get token metadata for non-existing token_id.
    This works fine:
const options = {
          address: "0xe2d2cbc74d88b99c3d595bba084623999f822f59",
          token_id: "77410248885823596044298240",
          chain: "bsc testnet"
        };
const tokenIdMetadata = await Moralis.Web3API.token.getTokenIdMetadata( options );
console.log(tokenIdMetadata);
  1. You need to call Parse.initialize before using Parse.

It means that you call api without initialization. You need to initialize your application.

In the JS SDK:

Moralis.initialize("YOUR_APP_ID");
Moralis.serverURL = 'https://YOUR_MORALIS_SERVER:1337/server'

In the React SDK:

<MoralisProvider appId="xxxxxxxx" serverUrl="xxxxxxxx">
    <App />
  </MoralisProvider>,

Hope this helps :man_mechanic:

@Yomoo thanks for the response. In regards to point 2 i have initialized Moralis properly with reactSDK and I still got this error. In regards to 1 point you are right, something is wrong with my contract.