metaplex
metaplex copied to clipboard
[Bug]: TypeError: Cannot read properties of undefined (reading 'program')
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
- [X] I have checked the docs and it didn't solve my issue
same issue
very frustrating, I can't update configs for existing candy machine, maybe this issue on devnet?
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.
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?
@Fantasim ^^
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.
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
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.
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 ?