Hi, It looks like last week June 13 2023, ipfs-http-client was deprecated. This is bad because it is how I am connecting to my IPFS dedicated gateway as per this issue: Add file to ipfs (node.js) - #4 by Flaveeu
As for Helia, it looks like it doesn’t support yet connecting to a remote ipfs provider but we’ll keep an eye and add tutorials when the time comes.
Hey, node version is 18.12.1 and I think it is more likely because the library has been closed and made read only (on june 13 2023). Can you please verify that your solution still works as described by
Include the file path in the request body, I used form-data and selected the down arrow in the key section to toggle the request to file. External Image
@traian.vila
I removed all restrictions so the key is open. it works with postman but i am getting an axios error doing it programmatically
see below:
async function ipfsPostFunction(folder, index, public_id){
const logs =logger.newLogger({fileName:'ipfsUpload.js',function:'ipfsUploadFunction', id:public_id});
logs.info("\n***** Configuring IPFS... *****");
try{
let API_KEY = process.env.API_KEY;
let API_SECRET = process.env.API_SECRET;
const projectIdAndSecret = `${API_KEY}:${API_SECRET}`
const auth = `Basic ${Buffer.from(projectIdAndSecret).toString('base64')}`
let url = 'https://ipfs.infura.io:5001/api/v0/add';
let file = `file=@".${folder}/${index}}"`
let options = {headers: {authorization: auth,'Content-Type': "multipart/form-data"},};
console.log(options);
let response = await axios.post(url, file, options );
response.on('response', function (response) {
response = JSON.parse("[" + data.split("}\n{").join("},{") + "]");
return data;
});
// console.log(response);
// console.log(`*** adding file: ${file}... ***`);
// let cid = await client.add(file);
// console.log(`*** successful transaction: ${cid.cid.toString()} ***`);
// figure out how to skip if already contained in list.
// return cid.cid.toString();
}catch(err){
logs.error("IPFS Failure: " +err);
return ('failed');
// cidList.push(err);
}
//console.log(cidList)
}
someone wrote to transform the response but I couldn’t find the exact way to do that… The error is an open bug for objects which are not proper JSON.
@dvncan@traian.vila I am seeing the same issue as of last week. I tried the helia route, but encountered the same problem of not being able to configure Infura as a 3rd party node. Still researching possible alternatives, but hitting a dead end for now and this is a blocker for some production work that needs to be done unfortunately.