Pinterest media upload fails with 411 MissingContentLength on self-hosted latest image
Describe the bug
Pinterest publishing fails on a self-hosted Postiz instance when uploading media to Pinterest's S3 upload endpoint.
The failure happens during the Pinterest media upload step, before the pin is created. The request is sent as multipart/form-data with Transfer-Encoding: chunked, but without a Content-Length header, and the Pinterest/S3 endpoint rejects it with 411 Length Required / MissingContentLength.
Environment
- Deployment: self-hosted Postiz
- Docker image:
ghcr.io/gitroomhq/postiz-app:latest - Pinterest app access: currently still in Trial mode
- Pinterest channel is connected successfully
- Board ID is selected in Postiz
What I tried
I tested Pinterest publishing from Postiz with a media post. The request reaches the Pinterest media upload endpoint, but fails with 411.
Relevant logs
AxiosError: Request failed with status code 411
url: https://pinterest-media-upload.s3-accelerate.amazonaws.com/
method: post
data: [FormData]
HTTP/1.1 request headers include:
Content-Type: multipart/form-data; boundary=...
Host: pinterest-media-upload.s3-accelerate.amazonaws.com
Connection: keep-alive
Transfer-Encoding: chunked
AWS/S3 response:
<Error>
<Code>MissingContentLength</Code>
<Message>You must provide the Content-Length HTTP header.</Message>
</Error>
Stack trace points to:
PinterestProvider.post
libraries/nestjs-libraries/src/integrations/social/pinterest.provider.tsI also see this message in the logs:
Email sender information not found in environment variablesHowever, this looks like a secondary notification/config warning, not the root cause of the Pinterest failure. The actual Pinterest failure is the 411 MissingContentLength response from pinterest-media-upload.s3-accelerate.amazonaws.com.
Related issue
There was a similar issue before: #1025 — Error 411 specific to video uploads only - while uploading Videos on Pinterest with self-hosted Postiz.
That issue was closed as not planned / stale, but it looks like the underlying problem was not solved. In my case, I am also self-hosted and using the latest Docker image. My Pinterest app is still in Trial mode, so I understand there may be additional Pinterest access limitations later, but this specific error seems to happen at the media upload step because the upload request is missing Content-Length.
Expected behavior
Postiz should either:
- upload the media successfully by sending a valid
Content-Lengthheader for the multipart/form-data upload, or - return a clear error if Pinterest Trial mode is the actual blocker.
Possible cause
The upload request seems to be sent with chunked transfer encoding. The Pinterest/S3 media upload endpoint appears to require a known content length, so the multipart body may need to be built from a buffer/file with a calculated Content-Length before calling Axios.
Question
Is Pinterest media publishing currently supported on self-hosted Postiz with the latest image, or does it require a code fix around the media upload request in pinterest.provider.ts?
Source: gitroomhq/postiz-app