P
Postiz2mo ago
Support

Ticket: "Postiz Discord Integration Error: Redirect Issue"

@egelhaus Just created a ticket
Question: Hey, I installed recently Postiz and I wanted to add my Discord Channel, but whenever I tried adding it, this came out of the WebUI: "Could not add provider. You are being redirected back"
Attempted: Resseting Discord's OAuth ID and Secret and Bot Token and setting the OAuth Redirect URI.
Working On: Adding the Discord Channel
Take it from here @Mod 🔥
60 Replies
egelhaus
egelhaus2mo ago
This came out of the Terminal: "[Nest] 151 - 10/25/2024, 12:16:29 PM ERROR [ExceptionsHandler] Request failed with status code 404 AxiosError: Request failed with status code 404 at settle (/app/node_modules/axios/dist/node/axios.cjs:2019:12) at IncomingMessage.handleStreamEnd (/app/node_modules/axios/dist/node/axios.cjs:3135:11) at IncomingMessage.emit (node:events:531:35) at endReadableNT (node:internal/streams/readable:1696:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) at Axios.request (/app/node_modules/axios/dist/node/axios.cjs:4287:41) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async LocalStorage.uploadSimple (/app/dist/apps/backend/main.js:3075:27) at async IntegrationService.createOrUpdateIntegration (/app/dist/apps/backend/main.js:2456:33) at async /app/node_modules/@nestjs/core/router/router-execution-context.js:46:28 at async /app/node_modules/@nestjs/core/router/router-proxy.js:9:17" @Nevo David can you help me?
Nevo David
Nevo David2mo ago
this is very weird, why is it using axios Oh I see the error it's not connect to discord did you configure local uploading or r2?
egelhaus
egelhaus2mo ago
uhh what do you mean by that?
Nevo David
Nevo David2mo ago
drop your .env
egelhaus
egelhaus2mo ago
wait with "not connected to discord" do you mean that it cant reach discord? one secomd services: postiz: image: ghcr.io/gitroomhq/postiz-app:latest container_name: postiz restart: always environment: # General Settings MAIN_URL: "https://myurl" FRONTEND_URL: "https://myurl" NEXT_PUBLIC_BACKEND_URL: "https://myurl/api" JWT_SECRET: "my_secret" ## App Enviroment Settings # Discord DISCORD_CLIENT_ID: "my_client_id" DISCORD_CLIENT_SECRET: "my_client_secret" DISCORD_BOT_TOKEN_ID: "my_token_id" # 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. # 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" volumes: - /psz-conf:/config/ - postiz-uploads:/uploads/ ports: - 5077:5000 networks: - postiz-network depends_on: postiz-postgres: condition: service_healthy postiz-redis: condition: service_healthy postiz-postgres: image: postgres:14.5 container_name: postiz-postgres restart: always environment: POSTGRES_PASSWORD: postiz-password POSTGRES_USER: postiz-user POSTGRES_DB: postiz-db-local volumes: - postgres-volume:/var/lib/postgresql/data ports: - 5432:5432 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: always ports: - 6379:6379 healthcheck: test: redis-cli ping interval: 10s timeout: 3s retries: 3 volumes: - 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 sorry for the long docker-compose
Nevo David
Nevo David2mo ago
BACKEND_INTERNAL_URL, can you set it like the NEXT_PUBLIC_BACKEND_URL?
egelhaus
egelhaus2mo ago
is it important that i use an external nginx porxy manager? yes one second
Nevo David
Nevo David2mo ago
No
egelhaus
egelhaus2mo ago
like this? BACKEND_INTERNAL_URL: "https://myurl/api"
Nevo David
Nevo David2mo ago
Yes
egelhaus
egelhaus2mo ago
alright, ill update it
Nevo David
Nevo David2mo ago
Do it also in the .env file
egelhaus
egelhaus2mo ago
i dont have one i configure everyting in my docker-compose.yml
Nevo David
Nevo David2mo ago
Alright, if you don't have one so don't do it 🙂
egelhaus
egelhaus2mo ago
same issue still get the error message
Nevo David
Nevo David2mo ago
your discord server has a picture?
egelhaus
egelhaus2mo ago
uhh yes
Nevo David
Nevo David2mo ago
Can you check in "Bot" that you have this:
No description
egelhaus
egelhaus2mo ago
it doesnt, ill update it and try again still showing me the same error in the ui and terminal
Nevo David
Nevo David2mo ago
do you have acceess to the code?
egelhaus
egelhaus2mo ago
uhh i have access to the volumes and i could set a new volume to a directory if you mean that
Nevo David
Nevo David2mo ago
I want to test something else in discord.provider.ts line 99
egelhaus
egelhaus2mo ago
in which directory is that?
Nevo David
Nevo David2mo ago
libraries/nestjs-libraries/src/integrations/social/discord.provider.ts
egelhaus
egelhaus2mo ago
ye i got it too at the same time
Nevo David
Nevo David2mo ago
console log this: { id: guild.id, name: application.name, accessToken: access_token, refreshToken: refresh_token, expiresIn: expires_in, picture: https://cdn.discordapp.com/avatars/${application.bot.id}/${application.bot.avatar}.png, username: application.bot.username, };
egelhaus
egelhaus2mo ago
one second, im trying to volume it ok, how do i do that?
Nevo David
Nevo David2mo ago
go to line 99 and add begore
egelhaus
egelhaus2mo ago
@Nevo David i fixed it
Nevo David
Nevo David2mo ago
before you fixed it? haha
egelhaus
egelhaus2mo ago
i didnt had an avatar at my bot buy my server i thought u meant like the server to send msgs to
Nevo David
Nevo David2mo ago
I will need to make a fix the support bots without pictures
egelhaus
egelhaus2mo ago
yes, but thank you for your help @Nevo David now i have another problem i cant send any discord messages
Nevo David
Nevo David2mo ago
Did you select the channel you want to post to?
egelhaus
egelhaus2mo ago
yes
Nevo David
Nevo David2mo ago
What is the error?
egelhaus
egelhaus2mo ago
one second 1: "{ "type": "now", "date": "2024-10-25T13:00:00",  "posts": [ { "integration": { "name": "egelhaus's Community", "id": "cm2osfi2q000141iobpwewwke", "internalId": "1290187367096913940", "disabled": false, "picture": "https://myurl/uploads/2024/10/25/1a61aa81e93a99c1b5f839a9d1e5348f.png", "identifier": "discord", "inBetweenSteps": false, "refreshNeeded": false, "display": "egelhaus's Communications", "type": "social", "time": [ { "time": 440  }, { "time": 730  }, { "time": 1020 } ], "changeProfilePicture": false, "changeNickName": true }, "value": [  { "content": "hello, test"  } ], "valid": true, "settings": { "channel": "1290662679043772466" }, "maximumCharacters": 280 } ] } event to dispatch: { pattern: 'post',  { id: 'cm2osr5se000841ioqz52q439', options: { delay: 0 }, payload: { id: 'cm2osr5se000841ioqz52q439' } } } proceccsing { id: 'cm2osr5se000841ioqz52q439' } Email sender information not found in environment variables Email sender information not found in environment variables"
Nevo David
Nevo David2mo ago
mmmm... and you don't see anything in discord?
egelhaus
egelhaus2mo ago
2: "[Nest] 161 - 10/25/2024, 1:57:20 PM ERROR [ExceptionsHandler] The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }). Error: The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }). at new OpenAI (/app/node_modules/openai/index.js:56:19) at new OpenAIAdapter (/app/node_modules/@copilotkit/runtime/dist/index.js:354:65) at CopilotController.chat (/app/dist/apps/backend/main.js:19704:29) at /app/node_modules/@nestjs/core/router/router-execution-context.js:38:29 at async /app/node_modules/@nestjs/core/router/router-execution-context.js:46:28 at async /app/node_modules/@nestjs/core/router/router-proxy.js:9:17" nop 3: "⨯ The requested resource isn't a valid image for /icons/platforms/undefined.png received text/html; charset=utf-8" thats all error
Nevo David
Nevo David2mo ago
oh, you don't see the icon of the channel in the list on the left?
egelhaus
egelhaus2mo ago
i do see them
Nevo David
Nevo David2mo ago
Can you try to change the picture of the bot from Postiz?
egelhaus
egelhaus2mo ago
wait, can i add the bot to mutliple servers?
Nevo David
Nevo David2mo ago
Yes
egelhaus
egelhaus2mo ago
ok
Nevo David
Nevo David2mo ago
what?
egelhaus
egelhaus2mo ago
alright and now?
Nevo David
Nevo David2mo ago
try to post something
egelhaus
egelhaus2mo ago
alright still doesnt work i can try to readd the bot
Nevo David
Nevo David2mo ago
Can you try in discord to give the vot bot all the possible permissions?
egelhaus
egelhaus2mo ago
yes
egelhaus
egelhaus2mo ago
when i try to ping it, or see in the leatherboard, i cant see it
No description
Nevo David
Nevo David2mo ago
Not sure what it means the bot works only with api we don't have an actual running bot
egelhaus
egelhaus2mo ago
Oh ok I got the Perms through the Members Tab Ill try to send a new message it send it thank you very much
Nevo David
Nevo David2mo ago
Mmm.. so it means we are not asking for all the required permissions I guess when adding the bot
egelhaus
egelhaus2mo ago
no, i think bcs my channel is locked or sumthing
Nevo David
Nevo David2mo ago
ohh ok
egelhaus
egelhaus2mo ago
bcs i got an verification setup
Support
SupportOP2mo ago
Hi @egelhaus Please select an action The thread is now closed
Nevo David
Nevo David2mo ago
@KΛZ |くたくた | Ø⅄ꓘ please have a look here

Did you find this page helpful?