Search code examples
ipfsipfs-http-client

Error uploading file: TypeError: source is not async iterable


Is there an issue with IPFS. nothing works

I get this ERROR when running ipfs daemon

2022-11-05T01:21:38.715+0100 ERROR tcp-tpt tcp/tcp.go:59 failed set keepalive period {"error": "set tcp4 192.168.1.6:4001->34.211.25.159:41218: setsockopt: invalid argument"}

import * as IPFS from 'ipfs-core'

const setURI = async (file, callback) => {
  try {
    const ipfs = await IPFS.create()
    const { cid } = await ipfs.add(file)
    console.info(cid)
   // callback(url)
  } catch (error) {
    console.error('Error uploading file: ', error)
  }  
}
export {
    setURI
}

Solution

  • This is a bug in the latest version of Babel: https://github.com/babel/babel/issues/15145

    A workaround is to downgrade by adding this to package.json:

      "resolutions": {
        "@babel/plugin-transform-async-to-generator": "7.17.12"
      },