Call to ipf through react app hanging forever

i am trying to add small json to ipfs using ipfs-http-client package , i can see ipfs running as daemon in local machine without any issues and alsoi am able to add string to ipfs through linux console but same i am trying from react app but its not working

const ipfsClient = require(‘ipfs-http-client’)

i have tried below two ways to create ipfs object both are returning object so no issues

const ipfs =  ipfsClient.create ({
   host: 'localhost',
    port: 5001,
    rotocol: 'http'

const ipfs = ipfsClient.create('/ip4/');

Problem is i am not able to add file to ipfs with below call , its hanging forever

obj[address] = {
            status: "Active"

        let buffer = Buffer.from(JSON.stringify(obj));
        return new Promise((resolve, reject) => {
            ipfs.add(buffer, async (error, response) => {
                if (error) {
                } else {
                    const hash = await response[0].hash;