I am Upload the Image in local server its working. but i am upload image on live server they are show some issue

Uncaught TypeError: Failed to construct ‘Response’: Please use the ‘new’ operator, this DOM object constructor cannot be called as a function.

import { create as ipfsHttpClient } from ‘ipfs-http-client’
const client = ipfsHttpClient(‘https://ipfs.infura.io:5001/api/v0’);

async function onChange(e) {

    const file = e.target.files[0];

    try {

      const added = await client.add(



        progress: (prog) => console.log(`received: ${prog}`)



      const url = `https://ipfs.infura.io/ipfs/${added.path}`;


      console.log("imageUrl", url)

    } catch (error) {

      console.log('Error uploading file: ', error)



Hi @abhimanyu_dilliwal and welcome to our Infura community!

Could you please let me know if there is any tutorial you’re following at this point?

I found the following dev.to post useful: Uploading Files to IPFS from a Web Application - DEV Community

Hope this helps.

hello @Flaviu
Thanks for response. I thing this error occurred in this line
const client = ipfsHttpClient(‘https://ipfs.infura.io:5001/api/v0’) and I am Replaced with
const client = new ipfsHttpClient(‘https://ipfs.infura.io:5001/api/v0’) as construct. its working on live server.


This link is quite useful. Everything related to the current topic has been mentioned in great detail.