Error when saving object to IPFS

Ever since I updated to 0.0.218 I have not been able to successfully save my NFT metadata in its json form to IPFS. There is no problem saving images, and the object and corresponding file are both formatted correctly. But when it gets time in my function to execute saving the object to IPFS I get XMLHttpRequest failed: "Unable to connect to the Parse API" and CORS errors for some reason.

subdomain: 6rfgbafqatcv

I did a quick test on one of my instances on 0.0.218 and was able to save a JSON object to IPFS using the similar code as the docs.

const blackFlail = {
  name: "Black Flail",
  damage_min: 9,
  damage_max: 20,
  speed: 1700,
  str: 70,
  level: 10,
  limit: 1
}
const file = new Moralis.File("black-flail.json", {base64: btoa(JSON.stringify(blackFlail))})
const result = await file.saveIPFS()

https://ipfs.moralis.io:2053/ipfs/QmVEFNVeBxXc1QmdvQPQSDk7pAaZhGFQcvJR5pxGdFUhXz

  • CORS errors are sometimes an indication there is an error in your Cloud code
  • Creating files is only allowed from the browser when there is an authenticated user
  • The “Unable to connect to Parse API” error could be an incorrect server URL or APP ID… have you made a new server recently and forgot to update this? Or made a copy/paste error?

I must have a syntax error somewhere or like you suggested a copy/paste error, just tried a test save and it does work…just not where I need it to :sweat_smile: Thank you for the reply!

1 Like

I’ve checked everything there is to check and still am getting caught up. Do you have any clues as to why I am getting a bad gateway and CORS errors three times in a row but on the fourth try it executes the save no problem?

This could be a scaling issue with our IPFS node. @rph or @gerardo15 could comment further.

Could this scaling issue also be a reason why I recently have to refresh my page a few times sometimes that queries/sets data from moralis? I have been recently getting 502 and/or 504 errors when updating the User table as well, yet my code that executes these actions hasn’t changed and was working perfectly before. It acts similar as to what I mentioned was happening before where I have to try to update the info a few times and then it eventually goes through

More specifically it takes three tries to update my User table with their profile photo