Help needed with a Thirdweb NFT Drop issue in my Next.js project!
I’m working on an NFT project using Next.js and Thirdweb. Everything seemed fine until I hit a snag with a call revert exception. Here’s what I’m dealing with:
const [mintedNFTs, setMintedNFTs] = useState(0)
const [maxNFTs, setMaxNFTs] = useState()
const nftCollection = useNFTDrop(dropAddress)
useEffect(() => {
if (!nftCollection) return
async function getNFTData() {
try {
const minted = await nftCollection.getAllMinted()
const max = await nftCollection.maxSupply()
setMintedNFTs(minted.length)
setMaxNFTs(max)
} catch (error) {
console.error('Failed to fetch NFT data:', error)
}
}
getNFTData()
}, [nftCollection])
When I run this, I get an error about a call revert exception. It mentions something about nextTokenIdToClaim() and CALL_EXCEPTION. Any ideas what might be causing this? I’m pretty new to NFT development, so I’m not sure where to look next. Thanks for any help!
I’ve encountered similar issues with Thirdweb NFT drops before. One potential cause could be incorrect contract initialization. Ensure your contract has been properly deployed and initialized with the correct parameters, especially regarding supply and minting limits.
Another possibility is a mismatch between the contract’s state and the frontend expectations. Try calling the contract methods directly using ethers.js to determine whether the issue originates from the contract or the Thirdweb SDK integration.
Additionally, check if there are any access control mechanisms in your contract that might be preventing the nextTokenIdToClaim() function from executing. If these suggestions do not resolve the issue, consider consulting Thirdweb’s support channels or their documentation for potential updates affecting your implementation.
yo WhisperingTree, that error’s a real bummer. Have u checked ur contract’s ABI? Sometimes it gets outta sync with the actual contract. Also, make sure ur wallet’s got enough gas and is connected to the right network. NFT drops can be finicky, but don’t give up! lemme know if u need more help troubleshooting.
hey there WhisperingTree! sounds like youre havin a bit of trouble with your nft project huh? that call revert exception can be a real pain 
ive run into similar issues before and it’s usually because of how the smart contract is set up. have you double-checked that your dropAddress is correct? sometimes a tiny typo can cause big headaches!
also, im curious - are you using the latest version of thirdweb? they’ve made some changes recently that might affect how nextTokenIdToClaim() works. maybe try updating your dependencies and see if that helps?
oh, and one more thing - are you testing this on a testnet or mainnet? sometimes the behavior can be different depending on the network.
let me know if any of this helps or if you need more ideas! nft dev can be tricky but its super rewarding when you figure it out 