-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
π Description
LinkedIn posts with images fail to publish, while text-only posts work correctly. X (Twitter) posts with images work fine using the same setup.
Error in logs:
[Error] posting on linkedin linkedin {} {} BadBody { identifier: 'linkedin', json: '{}', body: {}, message: '' }
π Reproduction steps
-
Setup Postiz with Docker Compose
docker compose up -d
-
Configure ngrok for HTTPS URL
ngrok http 5001
- Update all URL environment variables to use ngrok HTTPS URL
- Set
NOT_SECURED=false
-
Connect LinkedIn Account
- Create LinkedIn Developer App
- Add "Share on LinkedIn" product
- Configure OAuth redirect URI
- Add credentials to
.env - Connect LinkedIn account through Postiz UI
- β Connection succeeds
-
Schedule Text-Only Post to LinkedIn
- Create post with only text content
- Schedule for immediate or future time
- β Result: Post publishes successfully
-
Schedule Post with Image to LinkedIn
- Create post with text + image attachment
- Image uploads successfully to
/uploads/directory - Image URL generated as:
https://[ngrok-url].ngrok-free.app/uploads/2025/11/09/[filename].png - Schedule for immediate or future time
- β Result: Post fails with
BadBodyerror
π Expected behavior
LinkedIn posts with images should publish successfully, similar to how X (Twitter) posts with images work.
π Actual Behavior with Screenshots
LinkedIn posts with images fail immediately when the worker processes them:
3|workers | processing { id: 'cmhs4pa7l0003pk1c1lyrdseu', delay: 146144 }
3|workers | [Error] posting on linkedin linkedin {} {} BadBody {
identifier: 'linkedin',
json: '{}',
body: {},
message: ''
}
The body: {} indicates the request body is empty, suggesting the worker failed to construct the LinkedIn API request with the image.
π» Operating system
MacOS
π€ Node Version
the docker version
π Provide any additional context for the Bug.
Environment
- Postiz Version:
ghcr.io/gitroomhq/postiz-app:latest(as of Nov 9, 2025) - Deployment: Docker Compose (single container with all services)
- OS: macOS (Darwin 24.1.0)
- Database: PostgreSQL 17-alpine
- Redis: 7.2-alpine
- URL Setup: ngrok tunnel (HTTPS)
Configuration
# docker-compose.yml
services:
postiz:
image: ghcr.io/gitroomhq/postiz-app:latest
ports:
- "5001:5000"
volumes:
- ./uploads:/uploads/
env_file: .envEnvironment Variables
MAIN_URL=https://[ngrok-url].ngrok-free.app
FRONTEND_URL=https://[ngrok-url].ngrok-free.app
NEXT_PUBLIC_BACKEND_URL=https://[ngrok-url].ngrok-free.app/api
BACKEND_INTERNAL_URL=http://localhost:3000
NOT_SECURED=false
STORAGE_PROVIDER=local
UPLOAD_DIRECTORY=/uploads/
NEXT_PUBLIC_UPLOAD_DIRECTORY=/uploads/
# LinkedIn OAuth 1.0a Credentials
LINKEDIN_CLIENT_ID=AAAAAAAAAA
LINKEDIN_CLIENT_SECRET=BBBBBBBBBBLinkedIn App Configuration
- OAuth 2.0 Products Added:
- "Share on LinkedIn" (Default Tier)
- "Sign In with LinkedIn using OpenID Connect" (Standard Tier)
- Status: Products added but not yet verified (no green checkmark)
- Redirect URI:
https://[ngrok-url].ngrok-free.app/integrations/social/linkedin - Account Type: Personal LinkedIn profile
What Works
β
Text-only LinkedIn posts - Publish successfully
β
X (Twitter) posts with images - Publish successfully using same ngrok URL
β
X (Twitter) text-only posts - Publish successfully
β
LinkedIn OAuth connection - Authentication works correctly
β
Image upload to Postiz - Images save correctly to /uploads/ directory
β
Image URL accessibility - Images accessible via ngrok URL from browser and container
What Fails
β LinkedIn posts with images - Fail with empty BadBody error
Troubleshooting Performed
1. β Verified Image URL Accessibility
- Images are accessible at
https://[ngrok-url].ngrok-free.app/uploads/... - Tested from browser: β Works
- Tested from inside container: β Works
docker exec postiz-app wget -O- https://[ngrok-url].ngrok-free.app/uploads/2025/11/09/test.png
# Success: 200 OK2. β Verified OAuth Configuration
- LinkedIn app redirect URI matches Postiz configuration
- OAuth 2.0 flow works (can connect LinkedIn account)
- Access tokens are generated successfully
- Tested manual OAuth URL - redirects correctly
3. β Verified Worker Process
- Worker service is running correctly
- Text-only posts process successfully
- X posts with images process successfully
- Only LinkedIn + images combination fails
4. β Checked Log Details
Post data structure shows image path is correctly included:
{
"integration": { "id": "cmhs4jnki0001pk1cnslfx7hn" },
"value": [{
"content": "<p>Test post</p>",
"image": [{
"id": "91e341dd-4a25-48b6-8e3c-aa67503f22f1",
"path": "https://[ngrok-url].ngrok-free.app/uploads/2025/11/09/[filename].png"
}]
}]
}5. β οΈ LinkedIn Product Verification Status
- "Share on LinkedIn" product shows "Default Tier" but no green checkmark
- Product is added but not yet verified by LinkedIn
- However, text-only posts work, suggesting basic posting permission exists
- Question: Does image posting require additional LinkedIn product verification?
Comparison with X (Twitter)
The same setup works perfectly for X posts with images:
- Same ngrok URL configuration
- Same
/uploads/directory and volume mount - Same Docker container and worker process
- Images successfully uploaded to X API
This suggests the issue is specific to LinkedIn's image handling code in Postiz.
Suspected Root Cause
Based on the empty body: {} in the error, the likely causes are:
-
LinkedIn API image upload flow differs from X:
- X: Direct image upload with post
- LinkedIn: Might require separate image upload first, then reference in post
-
Missing LinkedIn permissions:
- The unverified "Share on LinkedIn" product might lack image upload permissions
- Text posting works but media posting might require additional approval
-
Bug in Postiz LinkedIn provider:
- Image download/processing fails
- LinkedIn API request construction fails when images are present
- Error handling doesn't provide detailed error message
Relevant Code Location
Based on logs, the error originates from:
/app/apps/backend/dist/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.js
Additional Context
Timeline of Events
- β Postiz setup and X integration working (text + images)
- β LinkedIn app created and configured
- β LinkedIn account connected through Postiz
- β Text-only LinkedIn post scheduled and published successfully
- β LinkedIn post with image scheduled but failed to publish
Worker Behavior
- Worker picks up the job:
processing { id: '...', delay: 146144 } - Immediately fails with
BadBodyerror - No retry attempts
- No detailed error message about what failed
Environment Variable Evolution
We tried multiple URL configurations before finding the ngrok solution:
- β
localhost:5001- Worker couldn't access from inside container - β
127.0.0.1:5000- Host port conflict with macOS ControlCenter - β ngrok HTTPS URL - Works for X, partially works for LinkedIn
Questions for Maintainers
-
Does LinkedIn image posting require the "Advertising API" product to be approved?
- We requested it but it's pending approval
-
Is there additional logging we can enable to see the actual LinkedIn API error?
- The
BadBodyerror with emptybody: {}doesn't provide details
- The
-
Does Postiz handle LinkedIn's two-step image upload process?
- Register upload
- Upload binary
- Reference in post
-
Are there known issues with LinkedIn image uploads in the current version?
Workaround
For now, we're using:
- LinkedIn for text-only posts β
- X (Twitter) for posts with images β
Logs
Full error sequence:
0|backend | {
0|backend | "type": "schedule",
0|backend | "posts": [{
0|backend | "integration": { "id": "cmhs4jnki0001pk1cnslfx7hn" },
0|backend | "value": [{
0|backend | "content": "<p>Test post with image</p>",
0|backend | "image": [{
0|backend | "id": "91e341dd-4a25-48b6-8e3c-aa67503f22f1",
0|backend | "path": "https://[ngrok-url].ngrok-free.app/uploads/2025/11/09/test.png"
0|backend | }]
0|backend | }]
0|backend | }]
0|backend | }
0|backend | event to dispatch: {
0|backend | pattern: 'post',
0|backend | data: { id: 'cmhs4pa7l0003pk1c1lyrdseu', options: { delay: 146144 } }
0|backend | }
3|workers | processing { id: 'cmhs4pa7l0003pk1c1lyrdseu', delay: 146144 }
3|workers | [Error] posting on linkedin linkedin {} {} BadBody {
identifier: 'linkedin',
json: '{}',
body: {},
message: ''
}
System Information
# Docker Compose version
Docker Compose version v2.x
# Container logs show
Nest application successfully started
π Backend is running on: http://localhost:3000
# All services running
0|backend - Backend process
1|frontend - Next.js frontend
2|workers - Worker process
3|cron - Cron jobsRelated Issues: (Search for similar LinkedIn image issues)
Would appreciate any guidance on:
- Enabling more detailed LinkedIn API error logging
- LinkedIn product verification requirements for image posting
- Whether this is a known limitation or bug
Thank you for maintaining Postiz! π
π Have you spent some time to check if this bug has been raised before?
- I checked and didn't find similar issue
Are you willing to submit PR?
None