js-examples
js-examples copied to clipboard
TypeError: Cannot read properties of null (reading 'guards')
Hello, I was trying to have the ui mint example to run. And I got the following message:
TypeError: Cannot read properties of null (reading 'guards')
The error happens at line 79 of MintNFTs.js.
const guard = candyMachine.candyGuard.guards;
My sugar config is like this:
{
"number": 5,
"symbol": "XX",
"sellerFeeBasisPoints": 500,
"isMutable": true,
"isSequential": false,
"creators": [
{
"address": "<address>",
"share": 100
}
],
"uploadMethod": "pinata",
"awsConfig": null,
"nftStorageAuthToken": null,
"shdwStorageAccount": null,
"pinataConfig": {
"jwt": "<token>",
"apiGateway": "https://api.pinata.cloud",
"contentGateway": "https://gateway.pinata.cloud",
"parallelLimit": 1
},
"hiddenSettings": null,
"guards": null
}
address and token are of course are changed to my wallet and key
I believe it assumes there will be guards? How can I get the UI to run?
Looks like you left out a step when setting up your candy machine. You have to add guards to the config file. Wasn't always the case but I believe this minting tutorial is based on Candy Machine V3, where it's necessary.
Hey @yukosgiti, did @falbanese90 post help you? Are you still seeing issues?
Thanks! I assumed if I didn't provide it, it would automatically do it (because there is an option withoutCandyGuard
)
Currently stuck on this, what fixed it?
@qudo-code If you scroll to this part in documentation https://docs.metaplex.com/programs/candy-machine/how-to-guides/my-first-candy-machine-part1#candy-guards---further-configuration You will see the guards part with those parameters
"guards": {
"default": {
"mintLimit": {
"id": 1,
"limit": 3
},
"solPayment": {
"value": 0.5,
"destination": "Tes1zkZkXhgTaMFqVgbgvMsVkRJpq4Y6g54SbDBeKVV"
},
"startDate": {
"date": "2022-10-23T20:00:00Z"
}
}
Add this guard section updating those guards with what you want to do in your config.json and the run those command
sugar guard add && sugar guard update
Hope it's clear
You can add some of the available guards as the above comment to pass the error. But to handle this case, we can ignore the guard handlers in case it does not exits.
Some parts still get this error, just ignore it like above.