Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vexdy opened this issue Mar 11, 2021 · 2 comments
Open

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

vexdy opened this issue Mar 11, 2021 · 2 comments

Comments

@vexdy
Copy link

vexdy commented Mar 11, 2021

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.

@jonathann403
Copy link

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

@vexdy
Copy link
Author

vexdy commented Apr 6, 2021

@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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants