SudhanPlayz / Discord-MusicBot

An advanced discord music bot, supports Spotify, Soundcloud, YouTube with Shuffling, Volume Control and Web Dashboard with Slash Commands support!
https://musicbot.darrenofficial.com
Other
2.99k stars 2.9k forks source link

Issue deploying to Heroku #690

Closed adrhine closed 2 years ago

adrhine commented 2 years ago

I am running my own Heroku project, and taking the source code here + following the documentation I was able to complete a Heroku deploy pretty easily. Only, I found a single problem that was occurring whenever I would attempt to run (using a worker dyno).

The logs weren't entirely clear what was happening, so I added a little more explicit logging and this is what I found was being output during startup:

2022-01-27T16:57:04.607501+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Web Server has been started
2022-01-27T16:57:04.640402+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: .wh..wh..opq
2022-01-27T16:57:04.640962+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Unable to load Command: , Reason: File doesn't had run/name/desciption
2022-01-27T16:57:04.641107+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: bassboost.js
2022-01-27T16:57:04.642543+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: bassboost
2022-01-27T16:57:04.643128+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: clear.js
2022-01-27T16:57:04.644300+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: clear
2022-01-27T16:57:04.644572+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: config.js
2022-01-27T16:57:04.646122+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: config
2022-01-27T16:57:04.646623+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: disconnect.js
2022-01-27T16:57:04.647655+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: disconnect
2022-01-27T16:57:04.647780+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: grab.js
2022-01-27T16:57:04.648801+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: grab
2022-01-27T16:57:04.649086+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: help.js
2022-01-27T16:57:04.649889+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: help
2022-01-27T16:57:04.650014+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: invite.js
2022-01-27T16:57:04.650892+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: invite
2022-01-27T16:57:04.651102+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: loop.js
2022-01-27T16:57:04.652141+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: loop
2022-01-27T16:57:04.652361+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: loopqueue.js
2022-01-27T16:57:04.654760+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: loopqueue
2022-01-27T16:57:04.654965+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: lyrics.js
2022-01-27T16:57:04.756966+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: lyrics
2022-01-27T16:57:04.757245+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: move.js
2022-01-27T16:57:04.758639+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: move
2022-01-27T16:57:04.762209+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: nowplaying.js
2022-01-27T16:57:04.763270+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: nowplaying
2022-01-27T16:57:04.763445+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: pause.js
2022-01-27T16:57:04.764536+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: pause
2022-01-27T16:57:04.764869+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: play.js
2022-01-27T16:57:04.766322+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: play
2022-01-27T16:57:04.766513+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: queue.js
2022-01-27T16:57:04.767563+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: queue
2022-01-27T16:57:04.767785+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: remove.js
2022-01-27T16:57:04.768914+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: remove
2022-01-27T16:57:04.769049+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: resume.js
2022-01-27T16:57:04.770066+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: resume
2022-01-27T16:57:04.770268+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: search.js
2022-01-27T16:57:04.771716+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: search
2022-01-27T16:57:04.774465+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: seek.js
2022-01-27T16:57:04.775534+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: seek
2022-01-27T16:57:04.775761+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: shuffle.js
2022-01-27T16:57:04.776643+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: shuffle
2022-01-27T16:57:04.776822+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: skip.js
2022-01-27T16:57:04.777726+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: skip
2022-01-27T16:57:04.777920+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: skipto.js
2022-01-27T16:57:04.778933+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: skipto
2022-01-27T16:57:04.779122+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: stats.js
2022-01-27T16:57:04.849652+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: stats
2022-01-27T16:57:04.854242+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: volume.js
2022-01-27T16:57:04.855865+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: volume
2022-01-27T16:57:04.856132+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Command: youtube.js
2022-01-27T16:57:04.857165+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Command Loaded: youtube
2022-01-27T16:57:04.858412+00:00 app[web.1]: 27:0:2022 - 16:57 | Info: Loading Event: .wh..wh..opq
2022-01-27T16:57:04.870021+00:00 app[web.1]: /usr/src/app/structures/DiscordMusicBot.js:222
2022-01-27T16:57:04.870021+00:00 app[web.1]: this.on(file.split(".")[0], event.bind(null, this));
2022-01-27T16:57:04.870021+00:00 app[web.1]: ^
2022-01-27T16:57:04.870022+00:00 app[web.1]: 
2022-01-27T16:57:04.870022+00:00 app[web.1]: TypeError: event.bind is not a function
2022-01-27T16:57:04.870022+00:00 app[web.1]: at /usr/src/app/structures/DiscordMusicBot.js:222:45
2022-01-27T16:57:04.870022+00:00 app[web.1]: at Array.forEach (<anonymous>)
2022-01-27T16:57:04.870023+00:00 app[web.1]: at /usr/src/app/structures/DiscordMusicBot.js:219:15
2022-01-27T16:57:04.870023+00:00 app[web.1]: at FSReqCallback.oncomplete (node:fs:188:23)
2022-01-27T16:57:05.223660+00:00 heroku[web.1]: Process exited with status 1
2022-01-27T16:57:05.308587+00:00 heroku[web.1]: State changed from starting to crashed

A little more research on these .wh..wh..opq files lead me to this: https://github.com/opencontainers/image-spec/blob/main/layer.md#whiteouts

This appears to be a result of the layering of images that Heroku steps through, that is then causing an issue when the bot attempts to iterate through the /events/ /commands/ directories.

Locally, I was able to reproduce the same issue by creating this file (or really any random file) in the /events/ or /commands/ dirs and then starting the app. I made some quick hacky changes locally to get past this (confirm that the files within these directories end with .js before trying to process them), but I'd rather not have to maintain a fork going forward to get around this issue.

I would be happy to open a suggestion PR if you agree this is something you would like to see changed for this project, but I'm assuming that my use-case is in the minority here so I understand if you do not want to make any changes to help with this issue.

SudhanPlayz commented 2 years ago

what are the files you have in /events/ ?

adrhine commented 2 years ago

/events/ contains all of the normal .js files you would expect from source, as well as the .wh..wh..opq file on the heroku container. I'm just using the same Dockerfile specified in source, and locally I don't see the whiteout file present.

But the presence of the .wh..wh..opq file throws the errors above you see in the logs and produces a fatal exception. Hopefully this makes sense - I can try to provide more info if it helps