I have a ubuntu server having cloudflare enabled in it. I have set up the nginx for reverse proxy, I have defined the ports and done IPFS setup.
While adding the file on the server I am getting the error that says: Unexpected token < in JSON at position 0
I am creating a buffer of a file and adding the data using ipfs.files.add function
.
Here is the code snippet:
let testBuffer = new Buffer(testFile);
ipfs.files.add(testBuffer, function (err, file) {
if (err) {
console.log(err);
res.send(responseGenerator.getResponse(500, "Failed to process your request!!!", []));
}
console.log(file)
}
Kindly help with the solution. Thanks.