postiz-app icon indicating copy to clipboard operation
postiz-app copied to clipboard

Cannot add channels - "Could not add provider" error when trying to add Instagram or other providers

Open Tobe2d opened this issue 3 months ago • 43 comments

When attempting to add any channel (Instagram, etc.), I receive the following error and the channel is not added:

Adding channel, Redirecting You
Could not add provider.
You are being redirected back

Steps to Reproduce:

Log in to Postiz instance

Navigate to Channels

Click "Add Channel"

Select any provider (Instagram, etc.)

Get redirected with the error message

Expected Behavior: The channel should be successfully added after authentication.

Actual Behavior: Authentication fails with the error message and no channel is added.

Environment:

Self-hosted Postiz using Docker

Latest image: ghcr.io/gitroomhq/postiz-app:latest

Configuration: Here's my docker-compose.yml :

services:
  postiz:
    image: ghcr.io/gitroomhq/postiz-app:latest
    container_name: postiz
    restart: unless-stopped
    environment:
      # You must change these. Replace `postiz.your-server.com` with your DNS name - this needs to be exactly the URL you're accessing Postiz on.
      MAIN_URL: "https://postiz.mydoomain.com"
      FRONTEND_URL: "https://postiz.mydoomain.com/"
      NEXT_PUBLIC_BACKEND_URL: "https://postiz.mydoomain.com/api"
      JWT_SECRET: "SqgRrNNg6ThNeqAmCdtCffOgRrNNg6ThNeqAmCdtCffOgRrNNg6ThNeqAmCdtCffOgRrNNg6ThNeqAmCdtCffOm7"
 
      # These defaults are probably fine, but if you change your user/password, update it in the
      # postiz-postgres or postiz-redis services below.
      DATABASE_URL: "postgresql://postiz-user:postiz-password@postiz-postgres:5432/postiz-db-local"
      REDIS_URL: "redis://postiz-redis:6379"
      BACKEND_INTERNAL_URL: "http://localhost:3000"
      IS_GENERAL: "true" # Required for self-hosting.
      DISABLE_REGISTRATION: "true" # Only allow single registration, then disable signup
      # The container images are pre-configured to use /uploads for file storage.
      # You probably should not change this unless you have a really good reason!
      STORAGE_PROVIDER: "local"
      UPLOAD_DIRECTORY: "/uploads"
      NEXT_PUBLIC_UPLOAD_DIRECTORY: "/uploads"
      #Youtube
      YOUTUBE_CLIENT_ID: "my google id"
      YOUTUBE_CLIENT_SECRET: "my google secret"
      #TikTok
      TIKTOK_CLIENT_ID: "my tiktok id"
      TIKTOK_CLIENT_SECRET: "my tiktok secret"
      #Instagram
      INSTAGRAM_APP_ID: "my istagram id"
      INSTAGRAM_APP_SECRET: "my istagram secret" 
      ######
      FACEBOOK_APP_ID: ""
      FACEBOOK_APP_SECRET: ""
      X_API_KEY: ''
      X_API_SECRET: ''
      THREADS_APP_ID: ''
      THREADS_APP_SECRET: ''
      TELEGRAM_BOT_NAME: ''
      TELEGRAM_TOKEN: ''
      SLACK_ID: ''
      SLACK_SECRET: ''
      REDDIT_CLIENT_ID: ''
      REDDIT_CLIENT_SECRET: ''
      PINTEREST_CLIENT_ID: ''
      PINTEREST_CLIENT_SECRET: ''
      MASTODON_CLIENT_ID: ''
      MASTODON_CLIENT_SECRET: ''
      LINKEDIN_CLIENT_ID: ''
      LINKEDIN_CLIENT_SECRET: ''
      DISCORD_CLIENT_ID: ''
      DISCORD_CLIENT_SECRET: ''
    volumes:
      - C:/Users/user/docker/postiz-app/postiz-config:/config/
      - C:/Users/user/docker/postiz-app/postiz-uploads:/uploads/
    ports:
      - 5002:5000
    networks:
      - postiz-network
    depends_on:
      postiz-postgres:
        condition: service_healthy
      postiz-redis:
        condition: service_healthy
 
  postiz-postgres:
    image: postgres:17-alpine
    container_name: postiz-postgres
    restart: unless-stopped
    environment:
      POSTGRES_PASSWORD: postiz-password
      POSTGRES_USER: postiz-user
      POSTGRES_DB: postiz-db-local
    volumes:
      - C:/Users/user/docker/postiz-app/postgres-volume:/var/lib/postgresql/data
    networks:
      - postiz-network
    healthcheck:
      test: pg_isready -U postiz-user -d postiz-db-local
      interval: 10s
      timeout: 3s
      retries: 3
  postiz-redis:
    image: redis:7.2
    container_name: postiz-redis
    restart: unless-stopped
    healthcheck:
      test: redis-cli ping
      interval: 10s
      timeout: 3s
      retries: 3
    volumes:
      - C:/Users/user/docker/postiz-app/postiz-redis-data:/data
    networks:
      - postiz-network
 
 
volumes:
  postgres-volume:
    external: false
 
  postiz-redis-data:
    external: false
 
  postiz-config:
    external: false
 
  postiz-uploads:
    external: false
 
networks:
  postiz-network:
    external: false

Additional Information:

All required environment variables for the providers are set (Instagram, YouTube, TikTok)

The instance is accessible at https://postiz.mydoomain.com

No relevant errors appear in the container logs when this occurs

The redirect happens immediately after clicking the provider, before any authentication flow begins

Questions:

Are there any additional configuration requirements for adding channels? Could this be related to URL configuration or SSL certificates? (I am using cloudflare domain) Are there any known issues with the channel provider authentication flow?

Tobe2d avatar Aug 03 '25 15:08 Tobe2d

+1 updated today to latest and facing same issue. Was able to access tiktok previously.

faisalthaheem avatar Aug 03 '25 23:08 faisalthaheem

Can you please try again on the latest version?

nevo-david avatar Aug 04 '25 08:08 nevo-david

Can you please try again on the latest version?

I just updated and it is still the same error

Image

Tobe2d avatar Aug 05 '25 04:08 Tobe2d

I have this same issue. New setted up instance of postiz. After redirect from ext. provider:

Image

meron1122 avatar Aug 05 '25 09:08 meron1122

Same problem here. Just fired up Postiz again after the revamp and tried to add Facebook and Instagram. Facebook lets you set permissions and it shows that Postiz is added, but I get the same issue that the previous posters.

Image

NoLooseEnds avatar Aug 05 '25 21:08 NoLooseEnds

On my end this error occurs because of SSL issues when inside corporate VPN. Normally we solve this by installing a root certificate in the affected image. Is there currently a recommended way to do this?

instanceofmel avatar Aug 06 '25 06:08 instanceofmel

@nevo-david Logs:

Image

But is not very descriptive. I only see a unhandled exception which crash backend. I'm hosted a postiz using Docker compose with Traefik as reverse proxy and lets encrypt as ssl provider on Traefik level.

meron1122 avatar Aug 06 '25 11:08 meron1122

Here is my log:

postiz           | 1|backend   | [Nest] 420  - 08/06/2025, 10:52:39 AM     LOG 🚀 Backend is running on: http://localhost:3000
postiz           | 1|backend   | /app/apps/backend/dist/libraries/nestjs-libraries/src/integrations/social/facebook.provider.js:165
postiz           | 1|backend   |             .filter((d) => d.status === 'granted')
postiz           | 1|backend   |              ^
postiz           | 1|backend   | TypeError: Cannot read properties of undefined (reading 'filter')
postiz           | 1|backend   |     at FacebookProvider.authenticate (/app/apps/backend/dist/libraries/nestjs-libraries/src/integrations/social/facebook.provider.js:165:14)
postiz           | 1|backend   |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
postiz           | 1|backend   |     at async /app/apps/backend/dist/apps/backend/src/api/routes/integrations.controller.js:228:26
postiz           | 1|backend   | Node.js v20.18.1
postiz           | 1|backend   |  ELIFECYCLE  Command failed with exit code 1.
postiz           | 1|backend   |  WARN   Local package.json exists, but node_modules missing, did you mean to install?
postiz           | PM2         | App [backend:1] exited with code [1] via signal [SIGINT]
postiz           | PM2         | App [backend:1] starting in -fork mode-
postiz           | PM2         | App [backend:1] online
postiz           | PM2         | App [backend:1] starting in -fork mode-
postiz           | PM2         | App [backend:1] online
postiz           | 1|backend   | > [email protected] start /app/apps/backend
postiz           | 1|backend   | > dotenv -e ../../.env -- node ./dist/apps/backend/src/main.js
postiz           | 1|backend   | [Nest] 481  - 08/06/2025, 2:04:13 PM     LOG [NestFactory] Starting Nest application...

NoLooseEnds avatar Aug 06 '25 12:08 NoLooseEnds

I have the same error

postiz | 2|backend | [Nest] 251 - 08/07/2025, 4:20:05 PM LOG 🚀 Backend is running on: http://localhost:3000 postiz | 2|backend | [ postiz | 2|backend | 'user.info.basic', postiz | 2|backend | 'video.publish', postiz | 2|backend | 'video.upload', postiz | 2|backend | 'user.info.profile' postiz | 2|backend | ] undefined postiz | 2|backend | node:internal/process/promises:389 postiz | 2|backend | new UnhandledPromiseRejection(reason); postiz | 2|backend | ^ postiz | 2|backend | UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<NotEnoughScopes>". postiz | 2|backend | at throwUnhandledRejectionsMode (node:internal/process/promises:389:7) postiz | 2|backend | at processPromiseRejections (node:internal/process/promises:470:17) postiz | 2|backend | at process.processTicksAndRejections (node:internal/process/task_queues:96:32) { postiz | 2|backend | code: 'ERR_UNHANDLED_REJECTION' postiz | 2|backend | } postiz | 2|backend | Node.js v20.18.1 postiz | 2|backend |  ELIFECYCLE  Command failed with exit code 1. postiz | 2|backend |  WARN  Local package.json exists, but node_modules missing, did you mean to install? postiz | PM2 | App [backend:2] exited with code [1] via signal [SIGINT] postiz | PM2 | App [backend:2] starting in -fork mode- postiz | PM2 | App [backend:2] online postiz | 2|backend | > [email protected] start /app/apps/backend postiz | 2|backend | > dotenv -e ../../.env -- node ./dist/apps/backend/src/main.js

pawel-domanski avatar Aug 07 '25 16:08 pawel-domanski

I was having this problem and managed to resolve it by a) restarting the docker properly (deleting the container) when doing changes b) creating a company page rather than using the generic developer company. c) verifying the company page d) authorising my profile for the company e) requesting product "advertising api"

StructuralWizard avatar Aug 15 '25 18:08 StructuralWizard

The error persists on my end. Any updates?

marco-ith avatar Aug 23 '25 15:08 marco-ith

Seems no fix till now

Tobe2d avatar Aug 23 '25 15:08 Tobe2d

Ok I tried adding the LinkedIn channel again, and this time it worked. I didn't make any changes.

marco-ith avatar Aug 23 '25 16:08 marco-ith

Ok I tried adding the LinkedIn channel again, and this time it worked. I didn't make any changes.

I thought this was a Meta (ie facebook/insta) specific bug?

NoLooseEnds avatar Aug 23 '25 16:08 NoLooseEnds

I tried adding the LinkedIn channel again. I am getting same error. "Could not add provider." Instagram, Facebook, X are OK, but Linkedin and Linkedin page are not working. Then I tested API infos with n8n, all of them are working very well in n8n, but Linkedin not connecting in postiz. I am using latest version. And I tried v1.56.0 to check the issue, I got same error message with latest and v1.56.0 versions. Latest version: https://github.com/gitroomhq/postiz-app/pkgs/container/postiz-app/483053848?tag=v2.5.3

postiz_app | 2|backend | AxiosError: Request failed with status code 403 postiz_app | 2|backend | at settle (/app/node_modules/axios/dist/node/axios.cjs:2053:12) postiz_app | 2|backend | at Unzip.handleStreamEnd (/app/node_modules/axios/dist/node/axios.cjs:3170:11) postiz_app | 2|backend | at Unzip.emit (node:events:530:35) postiz_app | 2|backend | at endReadableNT (node:internal/streams/readable:1698:12) postiz_app | 2|backend | at process.processTicksAndRejections (node:internal/process/task_queues:82:21) postiz_app | 2|backend | at Axios.request (/app/node_modules/axios/dist/node/axios.cjs:4280:41) postiz_app | 2|backend | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) postiz_app | 2|backend | at async LocalStorage.uploadSimple (/app/apps/backend/dist/libraries/nestjs-libraries/src/upload/local.storage.js:14:27) postiz_app | 2|backend | at async IntegrationService.createOrUpdateIntegration (/app/apps/backend/dist/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.js:54:19)

neekersen avatar Aug 28 '25 09:08 neekersen

@nevo-david Hello David, how can I add Linkedin and Linkedin page manually, using sql tables etc. in Postiz. I neen to add immediatly. Could you share a guide to add Linkedin and Linkedin page manually, please. Secound question is how can I add 2nd X or 2nd Linkedin profiles' API keys in .env file for our other company? (We are using self hosted Postiz)

neekersen avatar Aug 29 '25 11:08 neekersen

Adding channel, Redirecting You Could not add provider. You are being redirected back

wpt888 avatar Aug 29 '25 16:08 wpt888

I have the same issue considering linkedIn. AxiosError requested failed with status code 403

IJustDev avatar Aug 31 '25 20:08 IJustDev

Okay so I fixed it for me.

The 403 error occured in my case, because somehow the image could not be uploaded. So the thing I did is, to go to the integrationService and comment out the image upload.

@nevo-david Hello David, how can I add Linkedin and Linkedin page manually, using sql tables etc. in Postiz. I neen to add immediatly. Could you share a guide to add Linkedin and Linkedin page manually, please. Secound question is how can I add 2nd X or 2nd Linkedin profiles' API keys in .env file for our other company? (We are using self hosted Postiz)

IJustDev avatar Sep 01 '25 12:09 IJustDev

The 403 error occured in my case, because somehow the image could not be uploaded. So the thing I did is, to go to the integrationService and comment out the image upload.

@IJustDev Hi Alexander, could you please share the details immediatly. I want to fix it. How can I fix it? "So the thing I did is, to go to the integrationService and comment out the image upload." Could please a guide to solve the problem please.

neekersen avatar Sep 01 '25 16:09 neekersen

I will attach a patch soon with a detailed desc.

IJustDev avatar Sep 01 '25 16:09 IJustDev

The patch:

diff --git a/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.ts b/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.ts
index a54758e6..4043a99d 100644
--- a/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.ts
+++ b/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.ts
@@ -106,7 +106,11 @@ export class IntegrationService {
     const uploadedPicture = picture
       ? picture?.indexOf('imagedelivery.net') > -1
         ? picture
-        : await this.storage.uploadSimple(picture)
+        : await this.storage.uploadSimple(picture).catch((err) => {
+            console.error("Uploading the integrations image failed.");
+            console.error(err);
+            return undefined;
+          })
       : undefined;
 
     return this._integrationRepository.createOrUpdateIntegration(

Docker compose file changes:

services:                                                
  postiz:                                                                                                          
    build:                                               
      dockerfile: Dockerfile.dev                                                                                   
      context: ./postiz-app                                                                                        
    # image: ghcr.io/gitroomhq/postiz-app:latest

Context: I have a folder containing the docker-compose.yml file and the cloned source code in ./postiz-app

@neekersen

IJustDev avatar Sep 01 '25 18:09 IJustDev

Thank you so much @IJustDev

neekersen avatar Sep 02 '25 06:09 neekersen

Unfortunately, I also have this error, fresh installation. Every time I try to add a service, I see this in the logs:

Image

GrzegorzCymborski avatar Sep 03 '25 10:09 GrzegorzCymborski

Unfortunately, I also have this error, fresh installation. Every time I try to add a service, I see this in the logs:

Image

Try the fix I proposed for now. It looks like the same issue

IJustDev avatar Sep 04 '25 05:09 IJustDev

The patch:

diff --git a/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.ts b/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.ts
index a54758e6..4043a99d 100644
--- a/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.ts
+++ b/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.ts
@@ -106,7 +106,11 @@ export class IntegrationService {
     const uploadedPicture = picture
       ? picture?.indexOf('imagedelivery.net') > -1
         ? picture
-        : await this.storage.uploadSimple(picture)
+        : await this.storage.uploadSimple(picture).catch((err) => {
+            console.error("Uploading the integrations image failed.");
+            console.error(err);
+            return undefined;
+          })
       : undefined;
 
     return this._integrationRepository.createOrUpdateIntegration(

Docker compose file changes:

services:                                                
  postiz:                                                                                                          
    build:                                               
      dockerfile: Dockerfile.dev                                                                                   
      context: ./postiz-app                                                                                        
    # image: ghcr.io/gitroomhq/postiz-app:latest

Context: I have a folder containing the docker-compose.yml file and the cloned source code in ./postiz-app

@neekersen

I fixed using your fix codes. It's working, thanks a lot. I connected the Linkedin accounts in postiz after the fix.

I applied with this method.

I created a file, is named "Dockerfile.postiz"

FROM ghcr.io/gitroomhq/postiz-app:latest

USER root

RUN sed -i 's|: await this.storage.uploadSimple(picture)|: await this.storage.uploadSimple(picture).catch((err) => { console.error("Uploading the integrations image failed."); console.error(err); return undefined; })|g' \
    /app/apps/backend/dist/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.js

I modified docker-compose.yml file like this:

  postiz:
    build:
      context: .
      dockerfile: Dockerfile.postiz
    image: postiz-custom
    # image: ghcr.io/gitroomhq/postiz-app:latest

neekersen avatar Sep 04 '25 15:09 neekersen

It seems no one on the dev team has looked at this thread yet. We really need a permanent fix so we can pull a new image as updates are released, especially security and stability patches. Rebuilding custom images with a local patch works for now, but it will become a maintenance nightmare as updates get more frequent. We need upstream fix.

Tobe2d avatar Sep 04 '25 18:09 Tobe2d

I have the similar issue with the Telegram.

gadhiamitul41 avatar Sep 10 '25 17:09 gadhiamitul41

i have the exact same issue with instagram stnadalone

xiNeRoar avatar Sep 11 '25 06:09 xiNeRoar

I have the same problem with LinkedIn and nothing seems to work. Please, this needs an urgent solution. Does anyone know how to fix it from the yaml?

Pingaboy19 avatar Sep 13 '25 20:09 Pingaboy19