Skip to content

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

@vexdy

Description

@vexdy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions