Closed elishaakande closed 2 years ago
the code work when I upload from local host but as soon as I push to live server I keep getting satus 500 error
export const uploadFile = async(req, res) => { const client = new Web3Storage({ token: process.env.WEB3_STORAGE }) const base64 = req.body.file const fileName = req.body.filename const fileBuffer = Buffer.from(base64, 'base64') try { await writeFileSync(req.body.filename, fileBuffer); // Pack files into a CAR and send to web3.storage const file = await getFilesFromPath(req.body.filename); const rootCid = await client.put(file); // Get info on the Filecoin deals that the CID is stored in const info = await client.status(rootCid) // Promise<Status | undefined> await unlinkSync(req.body.filename) res.status(200).json(info.cid+".ipfs.dweb.link/"+fileName) } catch (error) { res.status(500).json(error) } }
when I try debugging the error, I think it's coming from const rootCid
this issue is from gitignore
the code work when I upload from local host but as soon as I push to live server I keep getting satus 500 error
when I try debugging the error, I think it's coming from const rootCid