Exception is occurred when i upload file to IPFS


i have got exception error when i try to upload file as below
2022-05-13 14:41:45 [e[32minfoe[39m] Unexpected token o in JSON at position 1

There was no problem until 5.12, and this error continued to occur suddenly from 5.13.
When I create a new project and try to upload it with the same code, it is confirmed that it works without any problem, so I delete the existing project first and use a new project.

Can you answer the cause of this error?

Hi :wave: @kim.sehyoung and welcome to the community!
Could you please include the exact code you use for the file upload to IPFS?

You also mentioned that the upload works with the new project created, do you still running code successfully?

yes. upload with new project still works successfully.

my code is like as below

const nftfile = uploadpath + req.file.originalname;
const buffer = await readNFTFile(nftfile);
try {
const ipfsHash = await ipfs.add(buffer || Buffer.alloc(buffer.length + 1));
const hash = ipfsHash[0].hash;
} catch (error) {

@lovekosmas please give any feedbacks.

Hi @kim.sehyoung please use upload with the new project id that as you mentioned before works successfully.
Your code snippet looks good!