metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!
https://metaplex.com
Apache License 2.0
3.32k stars 6.26k forks source link

[Bug]: On Revealing NFTs: Cannot Read Properties of undefined (reading, 'program') #1967

Closed Doughp closed 2 years ago

Doughp commented 2 years ago

Which package is this bug report for?

candy machine cli

Issue description

Getting this error when running update_existing_nfts_from_latest_cache_file or update_candy_machine.

Steps to reproduce: Upon creation of NFT Collection: Uploaded using arweave-sol as a hidden collection with hidden settings as: hidden: { Name: name uri: arweave link } On Reveal : Run update command given below to update cache to file with all of the correct links using command below

Command

ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts update_existing_nfts_from_latest_cache_file 
-e mainnet-beta
 -k  ~/.config/solana/mainPriv.json
 -cp C:\Users\name\Desktop2\~\config.json 
-c C:\Users\name\Desktop2\.cache\devnet-example.json 
-nc C:\Users\name\Desktop2\.cache\mainnet-beta-example.json

Relevant log output

(process:9584): GLib-GIO-WARNING **: 15:04:04.110: Unexpectedly, UWP app `3138AweZip.AweZip_1.4.8.0_x86__ffd303wmbhcjt' (AUMId `3138AweZip.AweZip_ffd303wmbhcjt!App') supports 168 extensions but has no verbs
 C:\Users\holly\OneDrive\Desktop\~\metaplex\js\packages\cli\src\candy-machine-v2-cli.ts:814
    const candyAddress = cacheContent.program.candyMachine;
                                      ^
TypeError: Cannot read properties of undefined (reading 'program')
    at Command.<anonymous> (C:\Users\holly\OneDrive\Desktop\~\metaplex\js\packages\cli\src\candy-machine-v2-cli.ts:814:39)

but I just replaced the the "cacheContent.program.candyMachine" with the string of the candy machine address and then I get the error of the cannot read (reading 'items')

Operating system

Windows

Priority this issue should have

High (immediate attention needed)

Check the Docs First

Doughp commented 2 years ago

@stegaBOB please give some kind of insight or something, and sorry I tagged you you're just the only one I know that I have seen answer.

usamakhan143 commented 2 years ago

Which package is this bug report for?

candy machine cli

Issue description

Getting this error when running update_existing_nfts_from_latest_cache_file or update_candy_machine.

Steps to reproduce: Upon creation of NFT Collection: Uploaded using arweave-sol as a hidden collection with hidden settings as: hidden: { Name: name uri: arweave link } On Reveal : Run update command given below to update cache to file with all of the correct links using command below

Command

ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts update_existing_nfts_from_latest_cache_file 
-e mainnet-beta
 -k  ~/.config/solana/mainPriv.json
 -cp C:\Users\name\Desktop2\~\config.json 
-c C:\Users\name\Desktop2\.cache\devnet-example.json 
-nc C:\Users\name\Desktop2\.cache\mainnet-beta-example.json

Relevant log output

(process:9584): GLib-GIO-WARNING **: 15:04:04.110: Unexpectedly, UWP app `3138AweZip.AweZip_1.4.8.0_x86__ffd303wmbhcjt' (AUMId `3138AweZip.AweZip_ffd303wmbhcjt!App') supports 168 extensions but has no verbs
 C:\Users\holly\OneDrive\Desktop\~\metaplex\js\packages\cli\src\candy-machine-v2-cli.ts:814
    const candyAddress = cacheContent.program.candyMachine;
                                      ^
TypeError: Cannot read properties of undefined (reading 'program')
    at Command.<anonymous> (C:\Users\holly\OneDrive\Desktop\~\metaplex\js\packages\cli\src\candy-machine-v2-cli.ts:814:39)

but I just replaced the the "cacheContent.program.candyMachine" with the string of the candy machine address and then I get the error of the cannot read (reading 'items')

Operating system

Windows

Priority this issue should have

High (immediate attention needed)

Check the Docs First

  • [x] I have checked the docs and it didn't solve my issue

Have you solved this issue I am also getting this property undefined error while revealing my collection

caaxieacademy commented 2 years ago

Same issue:

    const candyAddress = cacheContent.program.candyMachine;
                                      ^
TypeError: Cannot read properties of undefined (reading 'program')
    at Command.<anonymous> (C:\Users\**\metaplex\js\packages\cli\src\candy-machine-v2-cli.ts:1084:39)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
terrier-lover commented 2 years ago

Issue analysis

From the codebase, candy-machine-v2-cli.ts expects -c or -nc not to be a file path.

After I followed these steps, it was able to update the existing nfts.

(Step 1) Prepare the following files in the .cache directory.

.cache
├── devnet-example.json  // original cache file
└── devnet-example2.json // new cache file

(Step 2) Call update_existing_nfts_from_latest_cache_file with -c example and -nc example2

ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts update_existing_nfts_from_latest_cache_file \
-e devnet \
-k  ~/.config/solana/id.json \
-cp config.json \
-c example \
-nc example2

Here is the codebase that I referred to: https://github.com/metaplex-foundation/metaplex/blob/addbfe7e5c41945e1d51ebff6063add97b5d9ff5/js/packages/cli/src/candy-machine-v2-cli.ts#L1080-L1081 https://github.com/metaplex-foundation/metaplex/blob/addbfe7e5c41945e1d51ebff6063add97b5d9ff5/js/packages/cli/src/helpers/cache.ts#L5-L21

Potential next step

The help description of -nc seems to be a bit confusing since technically specifying the filepath at -nc does not have intended behavior. https://github.com/metaplex-foundation/metaplex/blob/addbfe7e5c41945e1d51ebff6063add97b5d9ff5/js/packages/cli/src/candy-machine-v2-cli.ts#L1071

-nc and -c should behave similar, so maybe fixing the description of -nc is reasonable? Here is the description of -c. https://github.com/metaplex-foundation/metaplex/blob/addbfe7e5c41945e1d51ebff6063add97b5d9ff5/js/packages/cli/src/candy-machine-v2-cli.ts#L1222

SOLROCKER-D commented 2 years ago

Having an issue similar to above.

C:\Users\customDguitars\Documents\SolRockers\source\metaplex-master\js\packages\cli\src> ts-node candy-machine-v2-cli.ts update_existing_nfts_from_latest_cache_file -e devnet -l debug -k C:\Users\customDguitars\Documents\SolRockers\Tokens\Addresses\Wallet\Testing\HCohQvDVkn1oFEoSRtY8gPfAMHaMrGVknmNqRQimgzV5.json -c temp -nc temp2 setting the log value to: debug wallet public key: HCohQvDVkn1oFEoSRtY8gPfAMHaMrGVknmNqRQimgzV5 (node:17416) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time (Use node --trace-warnings ... to show where the warning was created) (node:17416) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time program id from anchor cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ Creator pubkey: HCohQvDVkn1oFEoSRtY8gPfAMHaMrGVknmNqRQimgzV5 Environment: devnet Candy machine address: A3GPt9bHoCrxE6kyiB7ssPet2qi9BZnF1rJUagtonSnG Batch Size: 2 C:\Users\customDguitars\Documents\SolRockers\source\metaplex-master\js\packages\cli\src\commands\updateFromCache.ts:78 newCacheContent.items[i.toString()].link ^ TypeError: Cannot read properties of undefined (reading 'items') at updateMetadataFromCache (C:\Users\customDguitars\Documents\SolRockers\source\metaplex-master\js\packages\cli\src\commands\updateFromCache.ts:78:23) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async updateFromCache (C:\Users\customDguitars\Documents\SolRockers\source\metaplex-master\js\packages\cli\src\commands\updateFromCache.ts:47:5) at async Command. (C:\Users\customDguitars\Documents\SolRockers\source\metaplex-master\js\packages\cli\src\candy-machine-v2-cli.ts:1095:5)

SOLROCKER-D commented 2 years ago

Having an issue similar to above.

C:\Users\customDguitars\Documents\SolRockers\source\metaplex-master\js\packages\cli\src> ts-node candy-machine-v2-cli.ts update_existing_nfts_from_latest_cache_file -e devnet -l debug -k C:\Users\customDguitars\Documents\SolRockers\Tokens\Addresses\Wallet\Testing\HCohQvDVkn1oFEoSRtY8gPfAMHaMrGVknmNqRQimgzV5.json -c temp -nc temp2 setting the log value to: debug wallet public key: HCohQvDVkn1oFEoSRtY8gPfAMHaMrGVknmNqRQimgzV5 (node:17416) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time (Use node --trace-warnings ... to show where the warning was created) (node:17416) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time program id from anchor cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ Creator pubkey: HCohQvDVkn1oFEoSRtY8gPfAMHaMrGVknmNqRQimgzV5 Environment: devnet Candy machine address: A3GPt9bHoCrxE6kyiB7ssPet2qi9BZnF1rJUagtonSnG Batch Size: 2 C:\Users\customDguitars\Documents\SolRockers\source\metaplex-master\js\packages\cli\src\commands\updateFromCache.ts:78 newCacheContent.items[i.toString()].link ^ TypeError: Cannot read properties of undefined (reading 'items') at updateMetadataFromCache (C:\Users\customDguitars\Documents\SolRockers\source\metaplex-master\js\packages\cli\src\commands\updateFromCache.ts:78:23) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async updateFromCache (C:\Users\customDguitars\Documents\SolRockers\source\metaplex-master\js\packages\cli\src\commands\updateFromCache.ts:47:5) at async Command. (C:\Users\customDguitars\Documents\SolRockers\source\metaplex-master\js\packages\cli\src\candy-machine-v2-cli.ts:1095:5)

After further investigation, my after file contained an extra space at the end... in case that helps someone down the line