How can I use infura to upload static website to IPFS in VUE?

I test ipfs-http-client library by using the node ipfs.infura.io a week ago, it successful, But these days, I use the same way to upload files, it always timeout, Is infura block my IP ?
Or this is the free version limited ?

Thank you!

Hi there.
Welcome to the Infura community.
Can you help to share the request code with us as well as the full response error message?

const IpfsHttpClient = require('ipfs-http-client')

const options = {
  path: '',
  service: 'ipfs',
  host: 'ipfs.infura.io',
  //host: 'dweb.link',
  port: 443,
  protocol: 'https',
  //timeout: 20000,
  //verbose: false
};
  const uploadOptions = {
    //pin: false,
    wrapWithDirectory: false,
    progress: (prog) => console.log(`received: ${prog}`)
  } 

      const ipfs = IpfsHttpClient(options)

      this.ipfs.add(files, uploadOptions).then((result) => {
        console.log(result)
        console.log(result.cid.string)

        that.cidHash = result.cid.string
        that.isUploaing = false
          
      }).catch((e) => {

      })

we would recommend adding some error handling that attempts to re-add the content. This should help to ensure that whether there is a problem on the client side or the API side the content has a better chance of getting added.

Have you tried switching your network? There could be something like a firewall blocking access to IPFS.
Check your network panel to make sure you don’t have any other requests that are breaking and causing the error
Try adding “http://” at the start of the URL

If you switch your requests to using a Project ID and Project Secret as HTTP Basic Auth, we can assess your requests and get better information on where you may be seeing issues.

I didn’t bought the service, I am in China, I afraid it still can’t work, Can I have a test account for this?

This is my configuration of options

image

Hi @alac. This timedout error wasn’t due to any request rate limit on your current free plan.
Considering you being in China, the internet connection would be a good place to investigate further, as it may not be stable.
Are you using any VPN or Proxy?

This thread may be helpful for you as well How to use nginx proxy

I close the Proxy, A month ago, I use the service is ok, But after the infura service down last month, the service become unstable, and now, everything didn’t work, I don’t know why.

Hi @alac
Can you try adding more error handling to the code; enable verbose; as well as giving the proxy another try?

What handling code ? I am not familiar with this, Can you give me a demo ?
Thank you very much!

Hi @alac
It is quite likely a firewall issue. if you can use the proxy again and be able to narrow down the cause for this.

Can you try to add in functions to keep try to re-add the content when there’s an error such as the one you’re experiencing.