net::ERR_CONNECTION_RESET on ipfs.add

POST http://ipfs.infura.io:5001/api/v0/add?stream-channels=true&progress=false net::ERR_CONNECTION_RESET on ipfa.add()
Sample snippet:
Using CDN
App.ipfs = window.IpfsHttpClient.create({ host: “ipfs.infura.io”, port: “5001”})
const reader = new FileReader();
reader.onloadend = function() {
var buffer = require(‘buffer’);
const buf = buffer.Buffer.from(reader.result) // Convert data into buffer
App.ipfs.add(buf, (err, result) => { // Upload buffer to IPFS
if(err) {
console.error(err)
return
}
console.log(typeof result[0].hash)
console.log("Hash: " + result[0].hash)
let url = https://gateway.ipfs.io/ipfs/${result[0].hash}
console.log(Url --> ${url})
})
}
reader.readAsArrayBuffer(song.files[0]);

hi @shriram_ravi, are you consistently getting this error ?

It’s almost consistent on every restart of my client app. 3 out of 4 times. I would like to know what this error “net::ERR_CONNECTION_RESET” suggests.

I’m assuming you get this in the browser console ? net::ERR_CONNECTION_RESET is a generic error that indicates a network issue due to various reasons, caching, proxy, some dependent services not available yet, etc.
Try to add some extra loggers and pinpoint the exact code lines that throw the error.