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

[SUGGESTION OF FIX] "TypeError: customChains is not iterable" When verifying contract. #140

Open
facundocastello opened this issue Oct 6, 2022 · 3 comments

Comments

@facundocastello
Copy link

facundocastello commented Oct 6, 2022

PROBLEM

I get the next error when running 'verify' on typescript:

TypeError: customChains is not iterable
    at getEtherscanEndpoints (/Users/facundocastello/projects/hardhat-starter-kit/node_modules/@nomiclabs/hardhat-etherscan/src/network/prober.ts:33:37)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Environment._runTaskDefinition (/Users/facundocastello/projects/hardhat-starter-kit/node_modules/hardhat/src/internal/core/runtime-environment.ts:308:14)
    at async Environment.run (/Users/facundocastello/projects/hardhat-starter-kit/node_modules/hardhat/src/internal/core/runtime-environment.ts:156:14)
    at async SimpleTaskDefinition.verifySubtask [as action] (/Users/facundocastello/projects/hardhat-starter-kit/node_modules/@nomiclabs/hardhat-etherscan/src/index.ts:209:30)
    at async Environment._runTaskDefinition (/Users/facundocastello/projects/hardhat-starter-kit/node_modules/hardhat/src/internal/core/runtime-environment.ts:308:14)
    at async Environment.run (/Users/facundocastello/projects/hardhat-starter-kit/node_modules/hardhat/src/internal/core/runtime-environment.ts:156:14)
    at async verify (/Users/facundocastello/projects/hardhat-starter-kit/helper-functions.ts:46:9)
    at async Object.deployFunction [as func] (/Users/facundocastello/projects/hardhat-starter-kit/deploy/13_Deploy_BasicNFT.ts:30:9)
    at async DeploymentsManager.executeDeployScripts (/Users/facundocastello/projects/hardhat-starter-kit/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1220:22

another error that you can see for the same reason is when running yarn hardhat verify --network <NETWORK> <CONTRACT_ADDRESS> <CONSTRUCTOR_PARAMETERS> is the next one:

TypeError: Cannot read properties of undefined (reading 'map')
    at verifyAllowedChains (/Users/facundocastello/projects/hardhat-starter-kit/node_modules/@nomiclabs/hardhat-etherscan/src/config.ts:20:53)
    at SimpleTaskDefinition.verify (/Users/facundocastello/projects/hardhat-starter-kit/node_modules/@nomiclabs/hardhat-etherscan/src/index.ts:152:22)
    at Environment._runTaskDefinition (/Users/facundocastello/projects/hardhat-starter-kit/node_modules/hardhat/src/internal/core/runtime-environment.ts:308:35)
    at Environment.run (/Users/facundocastello/projects/hardhat-starter-kit/node_modules/hardhat/src/internal/core/runtime-environment.ts:156:25)
    at main (/Users/facundocastello/projects/hardhat-starter-kit/node_modules/hardhat/src/internal/cli/cli.ts:272:17)

the solution is the same one.

SOLUTION

The fix is to add customChains: [], afther the element on this line:

so it will be like this

    etherscan: {
        // yarn hardhat verify --network <NETWORK> <CONTRACT_ADDRESS> <CONSTRUCTOR_PARAMETERS>
        apiKey: {
            polygon: POLYGONSCAN_API_KEY,
            goerli: ETHERSCAN_API_KEY,
        },
        customChains: [],
    },
@shawnesquivel
Copy link

shawnesquivel commented Dec 15, 2022

I got the exact same error, and adding the property to etherscan as per your suggestion made my code work! Thank you 😁

    etherscan: {
        apiKey: ETHERSCAN_API_KEY,
        customChains: [],
    },

Would be great to get an explanation from the devs as to why this works.

@Bhavik-punmiya
Copy link

Thanks you solution worked for me

customChains: [],

@KevinFalah
Copy link

Thanks for the solution

tyler-tennant added a commit to tyler-tennant/hardhat-fund-me-fcc that referenced this issue Sep 2, 2024
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

4 participants