instagram-web-api icon indicating copy to clipboard operation
instagram-web-api copied to clipboard

Getting 400 - Header Content-Length has invalid value on uploadPhoto

Open vexdy opened this issue 3 years ago • 2 comments

I have a function which uploads the photo and returns the media.code from docs.

const upload_photo = async (client, path, caption, post) => {
  const { media } = await client.uploadPhoto({ photo: path, caption: caption, post: post});
  return media.code;
};

When I try to upload it from this function, I get this error message:

UnhandledPromiseRejectionWarning: StatusCodeError: 400 - "{\"debug_info\":{\"retriable\":false,\"type\":\"ParameterValidationError\",\"message\":\"Header Content-Length has invalid value\"}}"

Uploading my images from a path like this: ./path/to/my/image.jpg Tried to changing caption length, didnt work. Whats wrong? Thank you.

vexdy avatar Mar 11 '21 14:03 vexdy

I got The same issue, have you fixed that? maybe?

jonathann403 avatar Mar 28 '21 10:03 jonathann403

@GamerStop Sorry for late response,

I solved it with converting the image by buffer and uploading it as a buffer (which i got it in #206).

vexdy avatar Apr 06 '21 11:04 vexdy