Ipfs.add() is not returning any hash

I started to learn IFPS and below is the code I typed in my terminal to connect to the IPFS network

    > const ipfsClient = require('ipfs-http-client')
    > const ipfs = ipfsClient('https;//ipfs.infura.io:5001')
    > ipfs.add("data",(err,res)=>{console.log("ipfs: ",res)})

I was expecting any hash or error as output but terminal returned
Object [AsyncGenerator] {}

Previously I have tried to implement IPFS through javascript,

onSubmit = (event)=>{
  console.log("IPFS Result",result)
  // if(error) {
  //   console.error(error)
  //   return
  // }

But on calling onSubmit, no output was shown except the string “Submitting” and the value of the state variable buffer.

It would be very kind if someone help me out with what the problem is.

Hi @neucleophile it appears as though your URL may be incomplete, the add() method is documented here, https://infura.io/docs/ipfs/post/add

Try updating your URL per the format in the docs link and let me know if that helps!

Hi mike,

I am facing similar issue getting below error
UnhandledPromiseRejectionWarning: HTTPError: ipfs method not supported

below is the code

const auth =

'Basic ’ + Buffer.from(projectId + ‘:’ + projectSecret).toString(‘base64’)

const ipfs = ipfsClient.create ({

host: 'ipfs.infura.io',

port: 5001,

protocol: 'https',

headers: {

    authorization: auth


  apiPath: '/ipfs/api/v0'



    return new Promise((resolve, reject) => {

        ipfs.add(buffer, async (err, res,next) => {


            if (err) {


            } else {

                const hash = await res[0].hash;











any help really appreciated , i really stuck here to proceed further with development.

Hey @komaturir,

We recently updated our IPFS offering and have a new syntax for adding files - you can check it out here!

@neucleophile the url you provided is giving error 404!( https://infura.io/docs/ipfs/post/add )

@neucleophile were you able to solve this problem? Please shear you solution

@mike I mean to ask for a working url

Hey @stanley07 , you can check out these support tips for adding files using curl or with the ipfs-http-client javascript library.

Hope this helps!