Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of null (reading 'guards') #37

Open
yukosgiti opened this issue Feb 20, 2023 · 6 comments
Open

TypeError: Cannot read properties of null (reading 'guards') #37

yukosgiti opened this issue Feb 20, 2023 · 6 comments

Comments

@yukosgiti
Copy link

yukosgiti commented Feb 20, 2023

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?

@falbanese90
Copy link

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.

@MarkSackerberg
Copy link
Collaborator

Hey @yukosgiti,
did @falbanese90 post help you? Are you still seeing issues?

@yukosgiti
Copy link
Author

Thanks! I assumed if I didn't provide it, it would automatically do it (because there is an option withoutCandyGuard)

@qudo-code
Copy link

Currently stuck on this, what fixed it?
Screenshot 2023-03-23 at 8 53 00 PM

@Snoobie
Copy link

Snoobie commented May 7, 2023

@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

@tanlethanh
Copy link

tanlethanh commented Jul 6, 2023

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.

image

Some parts still get this error, just ignore it like above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants