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

Cannot read properties of undefined (reading '_bn') when use update_candy_machine #564

Closed AcoustiCoder closed 3 years ago

AcoustiCoder commented 3 years ago

I upload my files succesfully. But when try update candy machine i got this error.

wallet public key: E9WnMXUvr1fWLCyVT6pVCSzDEXJQzuBdFHrsZXZkTo3e /mnt/c/metap/metaplex/js/node_modules/@solana/web3.js/src/publickey.ts:29 return (value as PublicKeyData)._bn !== undefined; ^ TypeError: Cannot read properties of undefined (reading '_bn') at isPublicKeyData (/mnt/c/metap/metaplex/js/node_modules/@solana/web3.js/src/publickey.ts:29:35) at new PublicKey (/mnt/c/metap/metaplex/js/node_modules/@solana/web3.js/src/publickey.ts:45:9) at /mnt/c/metap/metaplex/js/packages/cli/src/candy-machine-cli.ts:564:26 at step (/mnt/c/metap/metaplex/js/packages/cli/src/candy-machine-cli.ts:53:23) at Object.next (/mnt/c/metap/metaplex/js/packages/cli/src/candy-machine-cli.ts:34:53) at fulfilled (/mnt/c/metap/metaplex/js/packages/cli/src/candy-machine-cli.ts:25:58) at processTicksAndRejections (node:internal/process/task_queues:96:5)

qualityrender commented 3 years ago

yeah I get the same problem, gone try to do a new fork and try the whole process again

AcoustiCoder commented 3 years ago

yeah I get the same problem, gone try to do a new fork and try the whole process again

any progress? i tryed everything and still same..

nikola43 commented 3 years ago

you need set start date before update

AcoustiCoder commented 3 years ago

you need set start date before update

i will try this thank you so much

Hiyorimi commented 3 years ago

doesn't work with any date --date "03 Oct 2021 21:54:00 GMT" or "now"

Cloned master.

AcoustiCoder commented 3 years ago

doesn't work with any date --date "03 Oct 2021 21:54:00 GMT" or "now"

Cloned master.

so we dont use date anymore?

samuelrondot commented 3 years ago

I have the same issue, how did you guys fixed this ?

Znomon commented 3 years ago

Had the same issue. You need to call create_candy_machine first

jordaaash commented 3 years ago

Closing as it sounds like there's a solution.

nicojochnick commented 2 years ago

I actually run into the issue when I call create_candy_machine, wondering if anyone has experienced the same?

Moikapy commented 2 years ago

Has this been resolved?

add1ct3dd commented 2 years ago

I am also getting this issue, and if I try create_candy_machine first I get

Transaction simulation failed: Error processing Instruction 0: custom program error: 0x8d

piscespieces commented 2 years ago

Getting

Error deploying config to Solana network. TypeError: Cannot read properties of undefined (reading '_bn') at isPublicKeyData

When running the command that is in the docs ts-node ~/metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-cli.ts upload ./assets --env devnet --keypair ~/.config/solana/devnet.json

zkhalapyan commented 2 years ago

@Znomon create_candy_machine actually needs to read in the .cache file; you will get the following error if you don't first upload your assets.

➜  burble git:(main) ✗ ts-node ~/metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-cli.ts create_candy_machine --env devnet --keypair  ~/.config/solana/id.json
wallet public key: 6zsuBDfuvtxK5FD9tf8u8LfrYBVnxDWRhj43snmC6Qx6
/Users/zkhalapyan/metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-cli.ts:777
    const config = new PublicKey(cacheContent.program.config);
                                              ^
TypeError: Cannot read properties of undefined (reading 'program')
    at Command.<anonymous> (/Users/zkhalapyan/metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-cli.ts:777:47)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
lukedupin commented 2 years ago

I was getting this error because one of my 0.json files's creators address field was invalid. After fixing the address field, everything began working.

jignesh6990 commented 2 years ago

Tried to find the solution for this issue since last 3 nights but nothing works. TypeError: Cannot read properties of undefined (reading '_bn') at isPublicKeyData (D:\Work\JP\lottery\metaplex\js\node_modules\@solana\web3.js\src\publickey.ts:35:35) at new PublicKey (D:\Work\JP\lottery\metaplex\js\node_modules\@solana\web3.js\src\publickey.ts:51:9) at getCandyMachineV2Config (D:\Work\JP\lottery\metaplex\js\packages\cli\src\helpers\various.ts:195:36) at Command. (D:\Work\JP\lottery\metaplex\js\packages\cli\src\candy-machine-v2-cli.ts:157:38) at processTicksAndRejections (node:internal/process/task_queues:96:5)

Screenshot 2022-04-01 115856

Nigh7Sh4de commented 2 years ago

I was running into this issue because I had misconfigured my gatekeeper in the config.json. To find the root cause, I edited ...\metaplex\js\node_modules\@solana\web3.js\lib\index.cjs.js and added the following line to function isPublicKeyData:

if (!value) return false;

In my case this changed the error message to:

    gatekeeper.gatekeeperNetwork = new web3.PublicKey(
                                ^
TypeError: Cannot create property 'gatekeeperNetwork' on string 'ignREusXmGrscGNUesoU9mxfds9AiYTezUKex2PsZV6'
    at getCandyMachineV2Config (C:\Users\Dennis\github\metaplex\js\packages\cli\src\helpers\various.ts:195:33)
    at Command.<anonymous> (C:\Users\Dennis\github\metaplex\js\packages\cli\src\candy-machine-v2-cli.ts:157:38)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Turns out I needed to set gatekeeperNetwork and expireOnUse on the root of my config.json instead of as properties of the gatekeeper on root (I really should get better at reading documentation):

"gatekeeper": {
  "gatekeeperNetwork": "ignREusXmGrscGNUesoU9mxfds9AiYTezUKex2PsZV6",
  "expireOnUse": true
},
naftalimurgor commented 1 year ago

Anyone ever resolved this issue? I'm running into a similar issue with Nextjs:

Server Error

TypeError: Cannot read properties of undefined (reading '_bn')
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Source

pages/MintNFTs.js (15:30) @ MintNFTs

  13 | const [disableMint, setDisableMint] = useState(true);
  14 | 
> 15 | const candyMachineAddress = new PublicKey(
     |                            ^
  16 |   process.env.NEXT_PUBLIC_CANDY_MACHINE_ID
  17 | );
  18 | let candyMachine;

Any pointers on how to resolve this are highly appreciated :pray: Thanks!