4

I'm uploading nft asset to Solana network and got this error.

TypeError: Cannot read properties of undefined (reading 'map')

I'm not sure what to adjust though I've referred to numerous tutorials. Below is the code snippet in upload script of metaplex:

if (i === 0 && !cacheContent.program.uuid) {
        // initialize config
        log.info(`initializing config`);
        try {
          const res = await createConfig(anchorProgram, walletKeyPair, {
            maxNumberOfLines: new BN(totalNFTs),
            symbol: manifest.symbol,
            sellerFeeBasisPoints: manifest.seller_fee_basis_points,
            isMutable: mutable,
            maxSupply: new BN(0),
            retainAuthority: retainAuthority,
            creators: manifest.properties.creators.map(creator => {
              return {
                address: new PublicKey(creator.address),
                verified: true,
                share: creator.share,
              };
            }),
          });
          cacheContent.program.uuid = res.uuid;
          cacheContent.program.config = res.config.toBase58();
          config = res.config;

          log.info(
            `initialized config for a candy machine with publickey: ${res.config.toBase58()}`,
          );

          saveCache(cacheName, env, cacheContent);
        } catch (exx) {
          log.error('Error deploying config to Solana network.', exx);
          throw exx;
        }
      }

And I was uploading the assets through CLI using the following command:

ts-node ~/metaplex-master/js/packages/cli/src/candy-machine-cli.ts upload /nft-assets --env devnet --keypair ~/.config/solana/devnet.json
112233
  • 2,406
  • 3
  • 38
  • 88

3 Answers3

2

Check the *.json files in assets folder again. Make sure the creator properties follow correct structure as in https://docs.metaplex.com/nft-standard#json-structure:

{
...
    "creators": [
      {
        "address": "SOLFLR15asd9d21325bsadythp547912501b",
        "share": 100
      }
    ]
}

It is not a plain array of public keys though

Phạm Huy Phát
  • 783
  • 9
  • 17
1

This question is missing the backtrace which makes it hard to tell where exactly the problem is.

In my case, I was missing the properties.creators in the metadata. To fix it, verify if you are missing one of the required entries.

Daniel Santos
  • 881
  • 2
  • 9
  • 17
0

In my case, I was missing ¸"seller_fee_basis_points" property in image metadata files. (0.json, 1.json, 2.json.....).Adding it to all the metadata files solved my problem.

(I was working with candy machine v2)

Make sure you check this documentation before preparing assets and config: https://docs.metaplex.com/candy-machine-v2/preparing-assets

---edit

check this config metadata rules and standard! https://docs.metaplex.com/nft-standard there are some required properties, make sure you have that !

for me adding "seller_fee_basis_points" and "symbol" property solved my issue!

{
  "name": "1",
->"symbol": "",
  "image": "0.png",
  "properties": {
    "files": [{ "uri": "0.png", "type": "image/png" }],
    "category": "image",
    "creators": [...]
  },
  "description": "",
->"seller_fee_basis_points": 500,
  "attributes": [...],
  "collection": {}
}
Vignesh
  • 1
  • 3