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 🔥
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
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?
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?
uhh
what do you mean by that?
drop your .env
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
BACKEND_INTERNAL_URL, can you set it like the NEXT_PUBLIC_BACKEND_URL?
is it important that i use an external nginx porxy manager?
yes one second
No
Yes
alright, ill update it
Do it also in the .env file
i dont have one
i configure everyting in my docker-compose.yml
Alright, if you don't have one
so don't do it 🙂
same issue
still get the error message
your discord server has a picture?
uhh
yes
Can you check in "Bot" that you have this:
it doesnt, ill update it and try again
still showing me the same error in the ui and terminal
do you have acceess to the code?
uhh
i have access to the volumes
and i could set a new volume to a directory
if you mean that
I want to test something else
in discord.provider.ts
line 99
in which directory is that?
libraries/nestjs-libraries/src/integrations/social/discord.provider.ts
ye i got it too at the same time
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,
};one second, im trying to volume it
ok, how do i do that?
go to line 99
and add begore
@Nevo David i fixed it
before
you fixed it? haha
i didnt had an avatar at my bot buy my server
i thought u meant like the server to send msgs to
I will need to make a fix
the support bots without pictures
yes, but thank you for your help
@Nevo David now i have another problem
i cant send any discord messages
Did you select the channel you want to post to?
yes
What is the error?
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"
mmmm... and you don't see anything in discord?
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
oh, you don't see the icon of the channel in the list on the left?
i do see them
Can you try to change the picture of the bot from Postiz?
wait, can i add the bot to mutliple servers?
Yes
ok
what?
alright
and now?
try to post something
alright
still doesnt work
i can try to readd the bot
Can you try in discord
to give the vot
bot
all the possible permissions?
yes
when i try to ping it, or see in the leatherboard, i cant see it
Not sure what it means
the bot works only with api
we don't have an actual running bot
Oh ok
I got the Perms through the Members Tab
Ill try to send a new message
it send it
thank you very much
Mmm.. so it means we are not asking for all the required permissions I guess
when adding the bot
no, i think bcs my channel is locked or sumthing
ohh ok
bcs i got an verification setup
Hi @egelhaus Please select an action
The thread is now closed
@KΛZ |くたくた | Ø⅄ꓘ please have a look here