code: 5400, message: 'Bad request: incomplete multipart stream'

I’m trying to upload image on cloudflare and getting error - “code: 5400, message: 'Bad request: incomplete multipart stream”. I’ve my code below. It already took 4 hrs and no luck. Please help me if anyone knows the solution.

export const uploadImageOnCloudflare = catchAsync(
  async (req: Request, res: Response, next: NextFunction) => {
    const body = new FormData();
    const encoded = req.file!.buffer.toString('base64');
    const blob = await fetch(`data:image/jpeg;base64,${encoded}`).then((res) =>

    body.append('file', blob, 'image.jpg');
    const result = await fetch(url, {
      method: 'POST',
      headers: {
          'multipart/form-data; boundary=---011000010111000001101001',
        Authorization: 'Bearer MY_TOKEN',
        'X-Auth-Key': 'MY_KEY'

    result.json().then((json) => console.log(json, '9999'));  // Getting failure here
      status: 'success',

This topic was automatically closed after 15 days. New replies are no longer allowed.