Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot quits with error code 1 on any command #362

Open
JoshuaMunoz opened this issue Nov 2, 2024 · 22 comments
Open

Bot quits with error code 1 on any command #362

JoshuaMunoz opened this issue Nov 2, 2024 · 22 comments
Labels
wontfix This will not be worked on

Comments

@JoshuaMunoz
Copy link

JoshuaMunoz commented Nov 2, 2024

Describe the bug
When I issue any command (/play, /summon, etc.), the bot generates an error in the log and quits.

To Reproduce
Steps to reproduce the behavior:

  1. Install bot
  2. Deploy Docker container
  3. Use slash command in Discord
  4. Bot quits

Expected behavior
I expect container to stay running and music to play

Additional context

[Nest] 28  - 11/02/2024, 9:56:59 PM    WARN [DiscordVoiceService] Current resource is is not playable. This means playback will get stuck. Please report this issue.
node:events:495
      throw er; // Unhandled 'error' event
      ^
Error: Unexpected server response: 404
    at ClientRequest.<anonymous> (/app/node_modules/ws/lib/websocket.js:912:7)
    at ClientRequest.emit (node:events:517:28)
    at HTTPParser.parserOnIncomingClient (node:_http_client:700:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
    at TLSSocket.socketOnData (node:_http_client:541:22)
    at TLSSocket.emit (node:events:517:28)
    at addChunk (node:internal/streams/readable:368:12)
    at readableAddChunk (node:internal/streams/readable:341:9)
    at Readable.push (node:internal/streams/readable:278:10)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)
Emitted 'error' event on WebSocket instance at:
    at emitErrorAndClose (/app/node_modules/ws/lib/websocket.js:1033:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Node.js v18.20.3
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@manuel-rw
Copy link
Owner

Hi,

  • please enable debug mode by setting env DEBUG to true
  • please post your entire log
  • please post your environment variables with password and tokens removed. Censor your Jellyfin domain.

Thank you

@JoshuaMunoz
Copy link
Author

JoshuaMunoz commented Nov 3, 2024

Log:

yarn run v1.22.19
$ node dist/main
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [NestFactory] Starting Nest application...
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] AppModule dependencies initialized +30ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] DiscordModule dependencies initialized +1ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] DiscoveryModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] PlaybackModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] ConfigHostModule dependencies initialized +1ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] ServeStaticModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] TerminusModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] ScheduleModule dependencies initialized +37ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] EventEmitterModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] ConfigModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] DiscordHostModule dependencies initialized +2ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] UpdatesModule dependencies initialized +1ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] JellyfinClientModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] DiscordModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] DiscordModule dependencies initialized +1ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] HealthModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] DiscordClientModule dependencies initialized +1ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] CommandModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [RoutesResolver] HealthController {/health}: +17ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [RouterExplorer] Mapped {/health, GET} route +2ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [PlayItemCommand] Subscribe to event(on): interactionCreate
(node:28) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 interactionCreate listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
[Nest] 28  - 11/03/2024, 3:16:35 PM     LOG [NestApplication] Nest application successfully started +559ms
[Nest] 28  - 11/03/2024, 3:17:16 PM     LOG [RegisterCommandService] All global commands are registered!
node:events:495
      throw er; // Unhandled 'error' event
      ^
Error: Unexpected server response: 404
    at ClientRequest.<anonymous> (/app/node_modules/ws/lib/websocket.js:912:7)
    at ClientRequest.emit (node:events:517:28)
    at HTTPParser.parserOnIncomingClient (node:_http_client:700:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
    at TLSSocket.socketOnData (node:_http_client:541:22)
    at TLSSocket.emit (node:events:517:28)
    at addChunk (node:internal/streams/readable:368:12)
    at readableAddChunk (node:internal/streams/readable:341:9)
    at Readable.push (node:internal/streams/readable:278:10)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)
Emitted 'error' event on WebSocket instance at:
    at emitErrorAndClose (/app/node_modules/ws/lib/websocket.js:1033:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Node.js v18.20.3
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

docker-compose:

version: '3.3'
services:
  manuel-rw:
    ports:
      - '3350:3000'
    environment:
      - DISCORD_CLIENT_TOKEN=VERYSECRET
      - JELLYFIN_SERVER_ADDRESS=https://something.something.something
      - JELLYFIN_AUTHENTICATION_USERNAME=ALSOSECRET
      - JELLYFIN_AUTHENTICATION_PASSWORD=BIGSECRET
      - DEBUG=true
    image: 'ghcr.io/manuel-rw/jellyfin-discord-music-bot:latest'

@manuel-rw
Copy link
Owner

Replace DEBUG:true with DEBUG=true. Also, no error in the log. Please reproduce the error and then send the log

@JoshuaMunoz
Copy link
Author

Edited in the previous post.

@manuel-rw
Copy link
Owner

Can you run /help? If yes, can you run /status?

@JoshuaMunoz
Copy link
Author

JoshuaMunoz commented Nov 3, 2024

/help works, /status throws an error BUT does not force the container to quit.

[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [NestFactory] Starting Nest application...
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] AppModule dependencies initialized +30ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] DiscordModule dependencies initialized +1ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] DiscoveryModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] PlaybackModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] ConfigHostModule dependencies initialized +1ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] ServeStaticModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] TerminusModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] ScheduleModule dependencies initialized +37ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] EventEmitterModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] ConfigModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] DiscordHostModule dependencies initialized +2ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] UpdatesModule dependencies initialized +1ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] JellyfinClientModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] DiscordModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] DiscordModule dependencies initialized +1ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] HealthModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] DiscordClientModule dependencies initialized +1ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [InstanceLoader] CommandModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [RoutesResolver] HealthController {/health}: +17ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [RouterExplorer] Mapped {/health, GET} route +2ms
[Nest] 28  - 11/03/2024, 3:16:34 PM     LOG [PlayItemCommand] Subscribe to event(on): interactionCreate
(node:28) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 interactionCreate listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
[Nest] 28  - 11/03/2024, 3:16:35 PM     LOG [NestApplication] Nest application successfully started +559ms
[Nest] 28  - 11/03/2024, 3:17:16 PM     LOG [RegisterCommandService] All global commands are registered!
node:events:495
      throw er; // Unhandled 'error' event
      ^
Error: Unexpected server response: 404
    at ClientRequest.<anonymous> (/app/node_modules/ws/lib/websocket.js:912:7)
    at ClientRequest.emit (node:events:517:28)
    at HTTPParser.parserOnIncomingClient (node:_http_client:700:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
    at TLSSocket.socketOnData (node:_http_client:541:22)
    at TLSSocket.emit (node:events:517:28)
    at addChunk (node:internal/streams/readable:368:12)
    at readableAddChunk (node:internal/streams/readable:341:9)
    at Readable.push (node:internal/streams/readable:278:10)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)
Emitted 'error' event on WebSocket instance at:
    at emitErrorAndClose (/app/node_modules/ws/lib/websocket.js:1033:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Node.js v18.20.3
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn run v1.22.19
$ node dist/main
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [NestFactory] Starting Nest application...
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] AppModule dependencies initialized +20ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] DiscordModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] DiscoveryModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] PlaybackModule dependencies initialized +1ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] ConfigHostModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] ServeStaticModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] TerminusModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] ScheduleModule dependencies initialized +21ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] EventEmitterModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] ConfigModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] DiscordHostModule dependencies initialized +2ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] UpdatesModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] JellyfinClientModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] DiscordModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] DiscordModule dependencies initialized +1ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] HealthModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] DiscordClientModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [InstanceLoader] CommandModule dependencies initialized +0ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [RoutesResolver] HealthController {/health}: +11ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [RouterExplorer] Mapped {/health, GET} route +3ms
[Nest] 28  - 11/03/2024, 3:23:41 PM     LOG [PlayItemCommand] Subscribe to event(on): interactionCreate
(node:28) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 interactionCreate listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
[Nest] 28  - 11/03/2024, 3:23:42 PM     LOG [NestApplication] Nest application successfully started +616ms
[Nest] 28  - 11/03/2024, 3:24:12 PM   ERROR [ExceptionsHandler] Received one or more errors
Error: Received one or more errors
    at _ArrayValidator.handle (/app/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1205:70)
    at _ArrayValidator.parse (/app/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:939:90)
    at EmbedBuilder.addFields (/app/node_modules/@discordjs/builders/dist/index.js:228:31)
    at mixin (/app/dist/commands/status.command.js:69:45)
    at DiscordMessageService.buildMessage (/app/dist/clients/discord/discord.message.service.js:43:24)
    at StatusCommand.handler (/app/dist/commands/status.command.js:65:44)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async target (/app/node_modules/@nestjs/core/helpers/external-context-creator.js:74:28)
    at async /app/node_modules/@nestjs/core/helpers/external-proxy.js:9:24
    at async Client.<anonymous> (/app/node_modules/@discord-nestjs/core/dist/explorers/command/command.explorer.js:66:37)
[Nest] 28  - 11/03/2024, 3:24:24 PM     LOG [RegisterCommandService] All global commands are registered!
[Nest] 28  - 11/03/2024, 3:24:48 PM   ERROR [ExceptionsHandler] Received one or more errors
Error: Received one or more errors
    at _ArrayValidator.handle (/app/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:1205:70)
    at _ArrayValidator.parse (/app/node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:939:90)
    at EmbedBuilder.addFields (/app/node_modules/@discordjs/builders/dist/index.js:228:31)
    at mixin (/app/dist/commands/status.command.js:69:45)
    at DiscordMessageService.buildMessage (/app/dist/clients/discord/discord.message.service.js:43:24)
    at StatusCommand.handler (/app/dist/commands/status.command.js:65:44)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async target (/app/node_modules/@nestjs/core/helpers/external-context-creator.js:74:28)
    at async /app/node_modules/@nestjs/core/helpers/external-proxy.js:9:24
    at async Client.<anonymous> (/app/node_modules/@discord-nestjs/core/dist/explorers/command/command.explorer.js:66:37)

@manuel-rw
Copy link
Owner

Do you have anything after your Jellyfin URL, like a slash /?
Your Jellyfin URL is probably wrong

@JoshuaMunoz
Copy link
Author

JoshuaMunoz commented Nov 3, 2024

I do not. formatted as https://something.something.xyz

@manuel-rw
Copy link
Owner

Can you open a shell inside the container and ping / request your Jellyfin?
https://stackoverflow.com/questions/30172605/how-do-i-get-into-a-docker-containers-shell

@JoshuaMunoz
Copy link
Author

I believe I'm in - how do I ping my JF server?

@JoshuaMunoz
Copy link
Author

CleanShot 2024-11-03 at 09 34 01@2x

@manuel-rw
Copy link
Owner

I believe I'm in - how do I ping my JF server?

Using ping, wget and curl

@JoshuaMunoz
Copy link
Author

jf

It worked. When I did ping, it only worked with no http:// or https:// - in the environment variable, I have https:// as part of the server address.

@manuel-rw
Copy link
Owner

Ping isn't enough yet. curl or wget your jellyfin http-/s address

@JoshuaMunoz
Copy link
Author

wget: bad address 'web' when using both IP address and also server URL.

@manuel-rw
Copy link
Owner

What wget did you execute? Example: wget https://my-jellyfin.com

@JoshuaMunoz
Copy link
Author

/app # wget jellyfin.my.domain
Connecting to jellyfin.my.domain (XXX.XX.XXX.XX:80)
Connecting to jellyfin.my.domain (XXX.XX.XXX.XX:443)
wget: bad address 'web'
/app # wget 192.168.1.112:8096
Connecting to 192.168.1.112:8096 (192.168.1.112:8096)
wget: bad address 'web'

@manuel-rw
Copy link
Owner

You need the protocol. eg. https://jellyfin.com

@JoshuaMunoz
Copy link
Author

root@openmediavault:/# docker exec -it discordmusicbot-manuel-rw-1 sh
/app # wget https://jellyfin.my.domain
Connecting to jellyfin.my.domain (XXX.XX.XXX.XX:443)
wget: bad address 'web'

@manuel-rw
Copy link
Owner

Your DNS setup is most likely not working: https://stackoverflow.com/a/78929430
See https://docs.docker.com/engine/network/ for more info

@manuel-rw manuel-rw added the wontfix This will not be worked on label Nov 3, 2024
@JoshuaMunoz
Copy link
Author

Hmm. Okay - this might take me a second...

@JoshuaMunoz
Copy link
Author

Is this correct?

The error message you're seeing indicates that a WebSocket connection attempt is resulting in a 404 response, which means that the requested resource could not be found. Here are some steps to help you troubleshoot and fix the issue:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants