metaplex-foundation / metaplex

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

[Bug]: TypeError: Cannot read properties of undefined (reading 'program') #2123

Open CiFrameVladislavB opened 2 years ago

CiFrameVladislavB commented 2 years ago

Which package is this bug report for?

candy machine cli

Issue description

I moved through the documentation, but this point I do not understand what I do wrong, gives an error

Command

./metaplex/js/packages/cli/src/candy-machine-v2-cli.ts update_candy_machine \ -e devnet \ -k SeJTuDJf9xRGfLYMAVC7Gi2XL6GAjVNcVUNzWBBphiN.json \ -cp config.json \ -c example

Relevant log output

wallet public key: SeJTuDJf9xRGfLYMAVC7Gi2XL6GAjVNcVUNzWBBphiN
C:\Users\Admin\metaplex\js\packages\cli\src\candy-machine-v2-cli.ts:840
    const candyMachine = new PublicKey(cacheContent.program.candyMachine);
                                                    ^
TypeError: Cannot read properties of undefined (reading 'program')
    at Command.<anonymous> (C:\Users\Admin\metaplex\js\packages\cli\src\candy-machine-v2-cli.ts:840:53)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Operating system

Windows 10

Priority this issue should have

High (immediate attention needed)

Check the Docs First

apejawn commented 2 years ago

same issue

barjakuzu commented 2 years ago

very frustrating, I can't update configs for existing candy machine, maybe this issue on devnet?

Fantasim commented 2 years ago

I managed to fix the issue manually in updating the code. The error come from free naming of the json file in your .cache folder (option -c when you created the machine, you must have put example as it's written in the documentation of the candy machine V2)

Rename the json file into : temp.json + Update the cacheName variable with "temp"

and everything should work.

cheers.

lollypolly-web3 commented 2 years ago

I managed to fix the issue manually in updating the code. The error come from free naming of the json file in your .cache folder (option -c when you created the machine, you must have put example as it's written in the documentation of the candy machine V2)

Rename the json file into : temp.json + Update the cacheName variable with "temp"

and everything should work.

cheers.

what file i should rename? this? image

lollypolly-web3 commented 2 years ago

@Fantasim ^^

eaubi commented 2 years ago

Go in your 'metaplex' directory and type

ts-node ./js/packages/cli/src/candy-machine-v2-cli.ts update_candy_machine \ -e devnet \ -k ../SeJTuDJf9xRGfLYMAVC7Gi2XL6GAjVNcVUNzWBBphiN.json \ -cp ../config.json \ -c example

instead of

ts-node ./metaplex/js/packages/cli/src/candy-machine-v2-cli.ts update_candy_machine \ -e devnet \ -k SeJTuDJf9xRGfLYMAVC7Gi2XL6GAjVNcVUNzWBBphiN.json \ -cp config.json \ -c example

The candy-machine-v2-cli.ts code is looking for the file ${env}-${cacheName}.json in the ./cache directory. In your case env=devnet (-e setting) and cacheName=example (-c setting) therefore if you have a valid devnet-example.json file in ./metaplex/.cache it should work.

AKMACH commented 2 years ago

this helped me fix the problem it seems like i was in the \metaplex-master\js\packages\cli\src directory and running the update command but when i transferred to 'metaplex' directory i had it working. it seems like it was .cache problem

gforcexx commented 2 years ago

I'm having this problem too and I tried the solutions above and the same error code above comes out. Are there any other solutions? Any help would be appreciated.

gforcexx commented 2 years ago

i recreated the .json file in the cache folder to look like this :

{ "program": { "uuid": "qPXk9m", "candyMachine": "qPXk9mPbqnwat1PNLm4qPXwat1PNV6tKmBHkqpwat1PNv" }, "items": {}, "env":"mainnet-beta", "cacheName":"temp" }

Am i doing something wrong ?