Open faresdevweb opened 1 year ago
try doing this -->
for (const fileIndex in files) {
const readableStreamForFile = fs.createReadStream(${fullImagesPath}/${files[fileIndex]}
)
const options = {
pinataMetadata:{
name:files[fileIndex]
},
}
try {
await pinata.pinFileToIPFS(readableStreamForFile, options)
.then((result)=>{
responses.push(result)})
.catch((err)=>{
console.log(err)
})
} catch (e) {
console.error(e)
}
}
if you have still problem then try doing debug by adding console.log between the codes then you can get where in your code has problem
const pinata = pinataSDK(pinataApiKey, pinata_secret_api_key);
In your utils/uploadToPinata.js
on line 7 -> 'new' is missing.
const pinata = new pinataSDK(pinataApiKey, pinata_secret_api_key);
Can you try this and see if it works?
I also have this issue, and I haven't been able to fix it
Hey! I'm following Patrick's courses on full stack web3 developpements and I'm running an Issue whit the deploy scripts of randomIpfsNFT
I just added the uploadToPinata.js function into utils and wrote the code to upload to Pinata, seems like the function is working correctly but it broke the files 02-deploy-random-ipfs-nft.js here is the code
while executing the command "yarn hardhat deploy --tags randomipfs,mocks, I have the following output error
Error: ERROR processing skip func of /hh-fcc/hardhat-nft-fcc/deploy/02-deploy-random-ipfs-nft.js: TypeError: Cannot call a class as a function
I'm not finding anything to resolve this on StackOverFlow or on this repo
So I tried something, the error occurs after adding this lines ->
const { storeImages } = require("../utils/uploadToPinata");
so after removing it from the code and comment theawait storeImages(imagesLocation)
in my deploy scripts it works correctlyso the issues is in this file
utils/uploadToPinata.js ->