For Workes & Pages, what is the name of the domain?
What is the error number?
5400
What is the error message?
[ { code: 5400, message: ‘Bad request: Error parsing form fields’ } ]
What is the issue or error you’re encountering
cannot name an image while uploading
What are the steps to reproduce the issue?
const updateUserPhoto = catchAsync(async (req, res) => {
try {
const cloudFlareURI = process.env.CLOUDFLARE_API.replace(
‘’,
process.env.CLOUDLFARE_ACCOUNT_ID
);
const image = req.file;
const body = {
file: image.buffer,
metadata: {
filename: image.originalname,
mimeType: image.mimetype,
},
};
const response = await axios.post(cloudFlareURI, body, {
headers: {
Authorization: `Bearer ${process.env.CLOUDFLARE_API_KEY}`,
'content-Type': 'multipart/form-data',
},
});
res.status(200).json(response.data);
} catch (err) {
console.log(err.response.data.errors);
res.status(500).json({ error: err.message });
}
});