wtfnotavailable / Discord-MusicBot

Discord Music Bot Source Tree
Other
179 stars 84 forks source link

Dashboard login loop #203

Closed Ryuo1 closed 7 months ago

Ryuo1 commented 9 months ago

Please describe the problem you are having in as much detail as possible:

image

This is running behind a reverse proxy:

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name musicbot.domain.com;

    underscores_in_headers on;

    ssl_certificate /certificates/musicbot/fullchain.pem;
    ssl_certificate_key /certificates/musicbot/privkey.pem;

    location / {
      proxy_pass http://127.0.0.1:8000;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_pass_request_headers on;
    }

    location /api {
      proxy_pass http://127.0.0.1:8010;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_pass_request_headers on;
    }

    location /ws {
      proxy_pass http://127.0.0.1:8001;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_pass_request_headers on;
    }

image

image

logs:

[06.02.2024 - 09:23]         | Spawned shard 0
[06.02.2024 - 09:23] [WARN ] | Bot running on OPLevel: 1
[06.02.2024 - 09:23] [WARN ] | Debug mode is [ENABLED]!
[06.02.2024 - 09:23] [WARN ] | Booting up the bot...
                               [REDACTED]/v5.5.0 (ID: [REDACTED])
[06.02.2024 - 09:23] [WARN ] | Loading error handlers...
[06.02.2024 - 09:23] [INFO ] | Loaded debug error handlers!
[06.02.2024 - 09:23] [DEBUG] | Music engine "Erela" has been loaded
[06.02.2024 - 09:23] [ERROR] | Prisma ORM failed to load
[06.02.2024 - 09:23] [ERROR] | Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues
[06.02.2024 - 09:23] [INFO ] | Slash commands have been loaded. Waiting for bot to finish initializing...
[06.02.2024 - 09:23] [INFO ] | Schedules have been loaded.
[06.02.2024 - 09:23] [INFO ] | Event listeners have been loaded.
[06.02.2024 - 09:23] [INFO ] | WS is now listening on port 8001
[06.02.2024 - 09:23] [INFO ] | Successfully logged in as [REDACTED]
[06.02.2024 - 09:23] [INFO ] | API is now listening on port 8010
[06.02.2024 - 09:23] [INFO ] | Slash commands have been pushed to application
[06.02.2024 - 09:23] [SILLY] | [REDACTED]/v5.5.0 (ID: [REDACTED]) is online!
[06.02.2024 - 09:23] [DEBUG] | Node: DockerNode | Lavalink node is connected.
prisma generate
[06.02.2024 - 09:26] [ERROR] | Unhandled server error:
[06.02.2024 - 09:26] [ERROR] | TypeError: Cannot read properties of null (reading 'userAuth')
TypeError: Cannot read properties of null (reading 'userAuth')
    at Object.updateUserAuth (/djs-bot/api/v1/dist/lib/db.js:28:30)
    at Object.handler (/djs-bot/api/v1/dist/routes/v1/routesHandler/login.js:72:22)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Further details:

Relevant client options:

idk

Abellio-R commented 9 months ago

Set in /etc/nginx/nginx.conf under the #basic settings

underscores_in_headers on;

that worked for me.

Or in the config file for the page itself in the server tags

Ryuo1 commented 9 months ago

it's already in the config

Neko-Life commented 9 months ago
[06.02.2024 - 09:23] [ERROR] | Prisma ORM failed to load
[06.02.2024 - 09:23] [ERROR] | Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
Ryuo1 commented 9 months ago

I suspected that was the error. Tried to find a fix for it, but failed to.

ttmx commented 8 months ago
[06.02.2024 - 09:23] [ERROR] | Prisma ORM failed to load
[06.02.2024 - 09:23] [ERROR] | Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.

I fixed this by making the container build the prisma model, but this did not fix the login loop.

Neko-Life commented 8 months ago
[06.02.2024 - 09:23] [ERROR] | Prisma ORM failed to load
[06.02.2024 - 09:23] [ERROR] | Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.

I fixed this by making the container build the prisma model, but this did not fix the login loop.

did you set the callback url in discord dev portal like the above screenshot of this issue? also make sure api url and ws url is pointing to the right domain and port as reported in the bot startup log

Searchcat37 commented 7 months ago

Had the same issue, I just had to remove the nodb argument and let postgres start. Dashboard works fine now

Buronn commented 4 months ago

For some reason, I am encountering an issue with my application, similar to the one mentioned here:

TypeError: Cannot read properties of null (reading 'userAuth')
    at Object.updateUserAuth (/djs-bot/api/v1/dist/lib/db.js:28:30)
    at Object.handler (/djs-bot/api/v1/dist/routes/v1/routesHandler/login.js:72:22)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I am unable to log in to my application. I am using Nginx Proxy Manager.

Error Screenshot

The callback works properly, but when it tries to POST to https://api.music.*********/api/v1/login with the code and redirect_uri payload, I receive a 400 Bad Request response.

Additionally, I am facing an issue with Prisma ORM failing to load, and I am unsure how to resolve it. Any guidance would be greatly appreciated.

Searchcat37 commented 4 months ago

What are your start arguments?


From: fburon @.> Sent: Wednesday, July 10, 2024 1:29:14 AM To: wtfnotavailable/Discord-MusicBot @.> Cc: Searchcat37 @.>; Comment @.> Subject: Re: [wtfnotavailable/Discord-MusicBot] Dashboard login loop (Issue #203)

For some reason, I am encountering an issue with my application, similar to the one mentioned here:

TypeError: Cannot read properties of null (reading 'userAuth') at Object.updateUserAuth (/djs-bot/api/v1/dist/lib/db.js:28:30) at Object.handler (/djs-bot/api/v1/dist/routes/v1/routesHandler/login.js:72:22) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I am unable to log in to my application. I am using Nginx Proxy Manager.

image.png (view on web)https://github.com/wtfnotavailable/Discord-MusicBot/assets/70445592/f2dd5f4c-d81f-4cd7-95a8-418011e62d3a

The callback works properly, but when it tries to POST to https://api.music.*********/api/v1/login with the code and redirect_uri payload, I receive a 400 Bad Request response.

Additionally, I am facing an issue with Prisma ORM failing to load, and I am unsure how to resolve it. Any guidance would be greatly appreciated.

— Reply to this email directly, view it on GitHubhttps://github.com/wtfnotavailable/Discord-MusicBot/issues/203#issuecomment-2219594018, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANLVKN7M7LHIGSMTGJIFZX3ZLTBCVAVCNFSM6AAAAABC3URDB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJZGU4TIMBRHA. You are receiving this because you commented.Message ID: @.***>

Buronn commented 4 months ago

What are your start arguments? ____ From: fburon @.> Sent: Wednesday, July 10, 2024 1:29:14 AM To: wtfnotavailable/Discord-MusicBot @.> Cc: Searchcat37 @.>; Comment @.> Subject: Re: [wtfnotavailable/Discord-MusicBot] Dashboard login loop (Issue #203) For some reason, I am encountering an issue with my application, similar to the one mentioned here: TypeError: Cannot read properties of null (reading 'userAuth') at Object.updateUserAuth (/djs-bot/api/v1/dist/lib/db.js:28:30) at Object.handler (/djs-bot/api/v1/dist/routes/v1/routesHandler/login.js:72:22) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) I am unable to log in to my application. I am using Nginx Proxy Manager. image.png (view on web)https://github.com/wtfnotavailable/Discord-MusicBot/assets/70445592/f2dd5f4c-d81f-4cd7-95a8-418011e62d3a The callback works properly, but when it tries to POST to https://api.music.*********/api/v1/login with the code and redirect_uri payload, I receive a 400 Bad Request response. Additionally, I am facing an issue with Prisma ORM failing to load, and I am unsure how to resolve it. Any guidance would be greatly appreciated. — Reply to this email directly, view it on GitHub<#203 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANLVKN7M7LHIGSMTGJIFZX3ZLTBCVAVCNFSM6AAAAABC3URDB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJZGU4TIMBRHA. You are receiving this because you commented.Message ID: @.***>

I tried the following configurations:

...
"start": "npx prisma generate --schema=./prisma/postgresql.prisma && npm ci && npm run bot"
...

and also the default option:

...
"start": "npm ci && npm run bot"
...

Neither configuration is working.

djs-bot    | [10.07.2024 - 06:10] [WARN ] | Debug mode is [ENABLED]!
djs-bot    | [10.07.2024 - 06:10] [WARN ] | Booting up the bot...
djs-bot    |                                InsertNameHereBot/v5.5.1 (ID: 918914919267700747)
djs-bot    | [10.07.2024 - 06:10] [WARN ] | Loading error handlers...
djs-bot    | [10.07.2024 - 06:10] [INFO ] | Loaded debug error handlers!
djs-bot    | [10.07.2024 - 06:10] [DEBUG] | Music engine "Erela" has been loaded
djs-bot    | [10.07.2024 - 06:10] [ERROR] | Prisma ORM failed to load
djs-bot    | [10.07.2024 - 06:10] [ERROR] | Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
djs-bot    | In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report
djs-bot    | [10.07.2024 - 06:11] [INFO ] | Slash commands have been loaded. Waiting for bot to finish initializing...
djs-bot    | (node:172) [FSTWRN002] FastifyWarning: The routes plugin being registered mixes async and callback styles, which will result in an error in `fastify@5`
djs-bot    | (Use `node --trace-warnings ...` to show where the warning was created)
djs-bot    | [10.07.2024 - 06:11] [INFO ] | Event listeners have been loaded.
djs-bot    | [10.07.2024 - 06:11] [INFO ] | Schedules have been loaded.
djs-bot    | [10.07.2024 - 06:11] [INFO ] | WS is now listening on port 3001
djs-bot    | [10.07.2024 - 06:11] [INFO ] | Successfully logged in as **********
djs-bot    | [10.07.2024 - 06:11] [INFO ] | API is now listening on port 8080

Additionally, if you are referring to dc, I ran it using ./dc.sh up.