I CLONED RARIBLE (Part 5) - missing url/hash attributes

Hello. Following this video introduction to Moralis minting and I am getting undefined attributes in my NFT object data. Assuming IPFS is working out of the box did i do anything wrong? Must be something simple im not realizing…

const createNft = async () => {
  if (uploadNftFileField.files.length == 0) {
    alert('Please select a file to upload');
  } else if (createNftTitleField.value.length == 0) {
    alert('Please give your NFT a title');

  const nftFile = new Moralis.File('nftFile.jpg', uploadNftFileField.files[0]);
  await nftFile.saveIPFS();

  const nftFilePath = nftFile.ipfs();
  const nftFileHash = nftFile.hash();

  const metadata = {
    name: createNftTitleField.value,
    description: createNftSaleStatusField.value,
    nftFilePath: nftFilePath,
    nftFileHash: nftFileHash

  const nftFileMetadataFile = new Moralis.File('metadata.json', { base64: btoa(JSON.stringify(metadata)) });
  await nftFileMetadataFile.saveIPFS();

  const nftFileMetadataFilePath = nftFileMetadataFile.ipfs();
  const nftFileMetadataFileHash = nftFileMetadataFile.hash();

  const Item = Moralis.Object.extend('Item');

  const item = new Item();
  item.set('nftTitle', createNftTitleField.value);
  item.set('nftDescription', createNftDescField.value);
  item.set('nftFilePath', nftFilePath.value);
  item.set('nftFileHash', nftFileHash.value);
  item.set('nftMetadataFilePath', nftFileMetadataFilePath.value);
  item.set('nftMetadataFileHash', nftFileMetadataFileHash.value);
  await item.save();

let createNftTitleField = document.getElementById('createNftTitleField');
let createNftDescField = document.getElementById('createNftDescField');
let createNftPriceField = document.getElementById('createNftPriceField');
let createNftSaleStatusField = document.getElementById('createNftSaleStatusField');
let uploadNftFileField = document.getElementById('uploadNftFileField');

let mintNftBtn = document.getElementById('mintNftBtn');
mintNftBtn.onclick = () => {

Thanks for any help!

Try to the move the “.value” when you assign to the item for the hash and path.



item.set('nftMetadataFilePath', nftFileMetadataFilePath);
item.set('nftMetadataFileHash', nftFileMetadataFileHash);

I knew it was something trivial! Cant believe i missed that soo many times.

Thank you!!