NFT Minter tutorial

The downloaded code from github does not work. When I press the submit button nothing happens, cannot figure out why. this is the main.js. The error that I got in console is the following : Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘lazyMint’)
at HTMLButtonElement.submit (main.js:47).


/** Connect to Moralis server */

const serverUrl = “”;

const appId = “jDL1R4vNL7kaj0WORerdQtKs0wwJWVPHK5KvJ7v0”;

Moralis.start({ serverUrl, appId });

let user = Moralis.User.current();

/** Add from here down */

async function login() {

if (!user) {

try {

  user = await Moralis.authenticate({ signingMessage: "Hello World!" });


} catch (error) {



} else {





function initApp() {

document.querySelector("#app").style.display = “block”;

document.querySelector("#submit_button").onclick = submit;


async function submit() {

const input = document.querySelector("#input_image");

let data = input.files[0];

const imageFile = new Moralis.File(, data);

await imageFile.saveIPFS();

let imageHash = imageFile.hash();

let metadata = {

name: document.querySelector("#input_name").value,

description: document.querySelector("#input_description").value,

image: "/ipfs/" + imageHash,



const jsonFile = new Moralis.File(“metadata.json”, {

base64: btoa(JSON.stringify(metadata)),


await jsonFile.saveIPFS();

let metadataHash = jsonFile.hash();


let res = await Moralis.Plugins.rarible.lazyMint({

chain: "rinkeby",

userAddress: user.get("ethAddress"),

tokenType: "ERC721",

tokenUri: "ipfs://" + metadataHash,

royaltiesAmount: 5, // 0.05% royalty. Optional





).innerHTML = NFT minted. <a href="${}:${}">View NFT;

document.querySelector("#success_message").style.display = “block”;

setTimeout(() => {

document.querySelector("#success_message").style.display = "none";

}, 5000);




Did you manage to solve this problem? (facing the same issue…)

Hey @luca.pizzola

Please always format your code before posting (guide)

Please provide both your js and html code

Hey @luca.pizzola, seems like you haven’t initialize your plugins, recommend you to call Moralis.initPlugins to do that before using any of the plugins’ functionality :raised_hands:

1 Like

initPlugins solved it for me. However, facing a new issue when calling lazyMint…

D/WebView: Uncaught (in promise) Error: Nothing saved to memory card
I/chromium: [INFO:CONSOLE(7146)] “Uncaught (in promise) Error: Nothing saved to memory card”, source: (7146)

This happens when the plugin returns an error.
Can you post the payload you are sending? Do you see any error in the console?

Hey dani,

We have moved to a different implementation…

We got that error and an Authentication Failure error (can’t remember the exact message)
Turns out that the Authentication failure message was triggered because of low intrinsic gas.

Haven’t solved the memory card issue since we are now using a different approach.

Thank you for your reply.

1 Like

Hey @Yuval

If you will face this issue once again in the future I will be happy to investigate!
I just tried again by just copy-pasting the code from the docs and worked immediately :slight_smile:



1 Like

yep, i solved! do u need help?

1 Like

Hey there, looking for the requisite changes to NFT Minter code to be able to lazy mint music nfts. All help will be appreciated :slight_smile:

Rarible plugin - installed
All steps followed
Facing one error

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘lazyMint’) at HTMLButtonElement.submit (main.js:46:45)