Moralis.Plugins.rarible.lazyMint Error: Provided chainId β€œ4” must match the active chainId β€œ1”

After I sent the image to ipfs and then sent the metadata to ipfs, the transmission succeeded and I got a response .
But when I sent the metadata to Moralis.Plugins.rarible.lazyMint I got this error :

MetaMask - RPC Error: Provided chainId β€œ4” must match the active chainId β€œ1”
[inpage.js:1:51626]

and I got this error :
Uncaught (in promise) Error: Provided chainId β€œ4” must match the active chainId β€œ1”
moralis.js:6355
tryCatch moralis.js:44099
…
…
moralis.js:6355:45

this is my code :
setTYhis()

async function setTYhis() {

    const imageFile = new Moralis.File(data.custom_fields.number_photo, { base64: photo })

    await imageFile.saveIPFS();

    let imageHash = imageFile.hash();

    console.log(imageFile.ipfs())

    let metadata = {

        name: data.name,

        description: data.description,

        image: "/ipfs/" + imageHash

    }

    const jsonFile = new Moralis.File("metadata.json", { base64: btoa(JSON.stringify(metadata)) });

    await jsonFile.saveIPFS();

    let metadataHash = jsonFile.hash();

    console.log(metadataHash)

    await Moralis.Plugins.rarible.lazyMint({

        chain: 'rinkeby',

        userAddress: '--',

        tokenType: 'ERC1155',

        tokenUri: 'ipfs://' + metadataHash,

        supply: 1,

        royaltiesAmount: 5, // 0.05% royalty. Optional

        list: true, // Only if lazy listing

        listTokenAmount: 1, // Only if lazy listing

        listTokenValue: 10 ** 18, // Only if lazy listing

        listAssetClass: 'ETH', // only if lazy listing  || optional

    })

    resDiv.innerHTML = " done! ";

    setTimeout(() => {

        // next one

    }, 1000)

}
1 Like

this sounds like active chain is ETH and provided chain is Rinkeby

1 Like

How do I change the active chain to Rinkeby

I don’t know exactly, I think that it shouldn’t matter what you have in metamask as it should be lazy minting

1 Like

Sorry, but I don’t understand what you mean

I don’t know what is the problem, I wanted to say that you can change that chain in metamask or what are you using to authenticate, but I think that it shouldn’t matter

Well thank you, I don’t think I know the solution either

Hi Henry, please let us know once you solve this issue. I got the same message too.


MetaMask - RPC Error: Provided chainId β€œ4” must match the active chainId β€œ1”

Uncaught (in promise) Error: Provided chainId β€œ4” must match the active chainId β€œ1”

I’m still actively looking for a solution. I’ll post the answer here once I find it.

1 Like

ChainId 4 is the Rinkeby test chain. In order to use Rinkeby with MetaMask you’ll need to enable the test networks in the β€œAdvanced” section of the extension settings.
Screen Shot 2022-01-18 at 12.58.03 PM

However, this will only solve the problem for development environments. ChainId 1 is mainnet which is where the real business happens. I still haven’t found Moralis documentation for how to switch to this.