soliditychainlink

Chainlink VRF callback gas limit set too low


I'm writing an integration test of my NFT practice project using Chainlink VRF v2 subscription method, but keep getting callback gas limit set too low error

My contract is deployed on sepolia testnet with following settings

and the account I use for testing also have enough sepoliaETH

You can find the full implementation of my practice project at https://github.com/ambersun1234/nft and the deployed contract

The subscription of Chainlink VRF that I created currently have 18 Link
The contract will spend 0.2 Link per call

The file for integration test is

Step to reproduce

$ git clone https://github.com/ambersun1234/nft
$ cd nft
$ yarn install
$ yarn hardhat test --network sepolia

I've checked all of the settings correct or not(gas lane, subscription id ... etc.)
and even change the gas limit up to 2500000 but all in vain

To check if Chainlink works on other network, I also checked goerli testnet of my another project and it works


Solution

  • Ok so the issue is simple
    make sure you put _safeMint before _setTokenURI
    otherwise you'll encounter with this weird issue