hi! When i’m about to test a portion of code from local to a test environment in a sub domain live
Uncaught ReferenceError: Moralis is not defined
at presale.js:1
      
    hi! When i’m about to test a portion of code from local to a test environment in a sub domain live
Uncaught ReferenceError: Moralis is not defined
at presale.js:1
we need more info, like where do you run that code, did you use something like:
        <script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
        <script src="https://unpkg.com/moralis/dist/moralis.js"></script>
in your html header?
Thanks for this, because I was trying the fetch of an image in s3 bucket. You told me I will have corse error when I tried it in localhost, now I’m trying it in a live server. and still cors problem 
 any thoughts?
Moralis.Cloud.define("test_fetch", async function(request){
    const im1 = "https://s3.ap-southeast-1.amazonaws.com/amethaverse.io/assets/images/test_1.png"
    const im1_data = await Moralis.Cloud.httpRequest({url: im1})
    const btoa = function(str){ return Buffer.from(str).toString('base64'); }
    const test = new Moralis.File("image.png", {base64 : btoa(im1_data.buffer)});
    return test;
});
        This works fine for me:
const btoa = function(str){ return Buffer.from(str).toString('base64'); }
Moralis.Cloud.define("test_fetch_2", async function(request){
    im1 = "https://s3.ap-southeast-1.amazonaws.com/amethaverse.io/assets/images/test_1.png"
    im1_data = await Moralis.Cloud.httpRequest({url: im1})
    //btoa = function(str){ return Buffer.from(str).toString('base64'); }
    test = new Moralis.File("image.png", {base64 : btoa(im1_data.buffer)});
    f = await test.save({useMasterKey: true});
    return f;
    //return test;
});
        This works perfect! but I’m having issue saving it to IPFS
      const dwarfImage = await Moralis.Cloud.run("test_fetch_2");
      console.log("dwarfImage", dwarfImage);
      //   const nftFileMint = new Moralis.File("nft.jpg", nftFile.files[0]);
      await dwarfImage.saveIPFS();
        you can save it directly on IPFS in that cloud function, I used there
    f = await test.save({useMasterKey: true});
but you can use
    f = await test.saveIPFS({useMasterKey: true});
and it will save it directly to IPFS in the cloud function
Hey Cryptokid< did you ever get this sorted out?im running and getting the same error…thanks a million
that shouldn’t be a problem, how does your code look like?