I ran this code yesterday on the mumbai testnet and worked fineā¦ now itās giving mke this error after I set up a new server on the mainnet. Am I missing something? Do I need to use a different API key rather than default?
Erorr:
PS C:\Album> node music.js
Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]: Request body larger than maxBodyLength limit
at RedirectableRequest.write (C:\Album\node_modules\follow-redirects\index.js:102:24)
at RedirectableRequest.end (C:\Album\node_modules\follow-redirects\index.js:127:10)
at dispatchHttpRequest (C:\Album\node_modules\axios\lib\adapters\http.js:401:11)
at new Promise ()
at httpAdapter (C:\Album\node_modules\axios\lib\adapters\http.js:48:10)
at dispatchRequest (C:\Album\node_modules\axios\lib\core\dispatchRequest.js:58:10)
at Axios.request (C:\Album\node_modules\axios\lib\core\Axios.js:108:15)
at Axios. [as post] (C:\Album\node_modules\axios\lib\core\Axios.js:140:17)
at Function.wrap [as post] (C:\Album\node_modules\axios\lib\helpers\bind.js:9:15)
at C:\Album\music.js:24:6 {
music.js:
let fs = require(āfsā);
let axios = require(āaxiosā);
let media = [āalbumcover.pngā, āFUNGKU.wavā, āHoles.wavā];
let ipfsArray = [];
let promises = [];
for (let i = 0; i < media.length; i++) {
promises.push(
new Promise((res, rej) => {
fs.readFile(`${__dirname}/export/${media[i]}`, (err, data) => {
if (err) rej();
ipfsArray.push({
path: `media/${i}`,
content: data.toString("base64"),
});
res();
});
})
);
}
Promise.all(promises).then(() => {
axios
.post("https://deep-index.moralis.io/api/v2/ipfs/uploadFolder", ipfsArray, {
headers: {
"X-API-KEY":
"I put Default API Key here",
"Content-Type": "application/json",
accept: "application/json",
},
})
.then((res) => {
console.log(res.data);
})
.catch((error) => {
console.log(error);
});
});
I really appreciate if someone could help with this!