MSFTserver / TipBot

Crypto coin TipBot for discord
MIT License
40 stars 117 forks source link

Bot Error - Node App Instance 0 loop [SOLVED] #19

Open god-father-xuez opened 5 years ago

god-father-xuez commented 5 years ago

I cant seem to pass this error - Codebase, wallet and dependencies installed but still cant seem to get the bot to work. These errors are found within the pm2 monit section

x TipBot > WARNING: NODE_APP_INSTANCE value of '0'      x
x                      xx did not match any instance config file names.         x
x                      xx PM2 > Change detected on path logs/tipbot-err-0.log   x
x                      xx for app TipBot - restarting                           x
x                      xx TipBot > WARNING: See https://github.com/lorenwest/n  x
x                      xx ode-config/wiki/Strict-Mode                           x
x                      xx PM2 > Stopping app:TipBot id:0                        x
x                      xx TipBot > [01-15-2019 06:25 pm PST][TipBot] 11         x
x                      xx aliases Loaded!                                       x
x                      xx PM2 > pid=19852 msg=failed to kill - retrying in      x
x                      xx NaNms                                                 x
x                      xx PM2 > pid=19852 msg=failed to kill - retrying in      x
x                      xx NaNms                                                 x
x                      xx PM2 > App [TipBot:0] exited with code [0] via         x
x                      xx signal [SIGINT]                                       x
x                      xx PM2 > pid=19852 msg=process killed                    x
x                      xx PM2 > App [TipBot:0] starting in -fork mode-          x
x                      xx PM2 > App [TipBot:0] online                           x
god-father-xuez commented 5 years ago

Additional Details

[PM2] Applying action restartProcessId on app [TipBot](ids: 0)
[PM2] [TipBot](0) ✓
┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────┬───────────┬────
│ App name │ id │ mode │ pid   │ status │ restart │ uptime │ cpu │ mem       │ use
├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────┼───────────┼────
│ TipBot   │ 0  │ fork │ 15587 │ online │ 629     │ 0s     │ 0%  │ 13.1 MB   │ tes
└──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────┴───────────┴────
 Use `pm2 show <id|name>` to get more details about an app
Done in 0.44s.
#:~/Documents/TipBot$ pm2 update
Be sure to have the latest version by doing `npm install pm2@latest -g` before doi
[PM2] Saving current process list...
[PM2] [v] Modules Stopped
[PM2] Applying action deleteProcessId on app [all](ids: 0)
[PM2] [TipBot](0) ✓
[PM2] [v] All Applications Stopped
[PM2] [v] PM2 Daemon Stopped
[PM2] Spawning PM2 daemon with pm2_home=/home/testserver/.pm2
[PM2] Restoring processes located in /home/testserver/.pm2/dump.pm2
[PM2] Process /home/testserver/Documents/TipBot/bot/bot.js restored
>>>>>>>>>> PM2 updated
┌──────────┬────┬─────────┬──────┬───────┬────────┬─────────┬────────┬─────┬──────
│ App name │ id │ version │ mode │ pid   │ status │ restart │ uptime │ cpu │ mem
├──────────┼────┼─────────┼──────┼───────┼────────┼─────────┼────────┼─────┼──────
│ TipBot   │ 0  │ 1.0.0   │ fork │ 15909 │ online │ 0       │ 0s     │ 0%  │ 24.2
└──────────┴────┴─────────┴──────┴───────┴────────┴─────────┴────────┴─────┴──────
 Use `pm2 show <id|name>` to get more details about an app
god-father-xuez commented 5 years ago

Seems like Yimp|NPM is causing this issue?


warning discord.js > snekfetch@3.6.4: use node-fetch instead
warning embed-creator@1.2.4: Creating embeds is a simple task that should not be done through one function. Please use Discord.js's functions instead.
warning jsonpath > jison > nomnom@1.5.2: Package no longer supported. Contact support@npmjs.com for more info.
warning jsonpath > jison > jison-lex > nomnom@1.5.2: Package no longer supported. Contact support@npmjs.com for more info.
warning regex > jison > nomnom@1.5.2: Package no longer supported. Contact support@npmjs.com for more info.
[2/4] Fetching packages...
info fsevents@1.2.6: The platform "linux" is incompatible with this module.
info "fsevents@1.2.6" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > discord.js@11.4.2" has unmet peer dependency "bufferutil@^3.0.3".
warning " > discord.js@11.4.2" has unmet peer dependency "erlpack@discordapp/erlpack".
warning " > discord.js@11.4.2" has unmet peer dependency "node-opus@^0.2.7".
warning " > discord.js@11.4.2" has unmet peer dependency "opusscript@^0.0.6".
warning " > discord.js@11.4.2" has unmet peer dependency "sodium@^2.0.3".
warning " > discord.js@11.4.2" has unmet peer dependency "libsodium-wrappers@^0.7.3".
warning " > discord.js@11.4.2" has unmet peer dependency "uws@^9.14.0".
[4/4] Building fresh packages...```
MSFTserver commented 5 years ago

solved in discord DM, suggested adding new folder name logs to ignore watch list

telostia commented 5 years ago

where to put logs folder? in root? I tried that, didnt help solve it

MSFTserver commented 5 years ago

@telostia doesnt matter just has to coincide with whats inside ecosystem.config.js so pm2 knows where to write the logs to

telostia commented 5 years ago

whats odd is that. even with the right ecosystem.config.js configs. its stil giving the error... nodejs updated, tried on both windows and linux , updated pm2. there is something really wrong here. Heres the details to the file: module.exports = { apps: [ { name: 'tipbot', script: './bot/bot.js', cwd: './botfolder', instance_id_env: '0', watch: true, ignore_watch : ['node_modules', 'logs', 'Downloads', '.git'], error_file: './tipbot-err.log', out_file: './tipbot-out.log', env: { NODE_ENV: 'development' }, env_production: { NODE_ENV: 'production' } } ] };

and heres whats in the default.json : "moderation":{ "pm2Name": "tipbot", "perms": ["Admin","Moderator","Community Leader","Bots", "bots"], "botDev": "bots", "logchannel": "ommited", "botspamchannels": ["ommited"] }

Heres the screenshot of it constantly restarting pm2: image

Heres the error from the log:

image

Those are just pretty much default values. Am I doing something wrong there?

MSFTserver commented 5 years ago

did you rename the config file...says it cant see one

telostia commented 5 years ago

ecosystem.config.js? yes. those are the first things i do. If I haven't then there wouldnt be any log files generated right?

telostia commented 5 years ago

ok I found the problem. cwd: './botfolder', should be pointing to ./ since I only renamed the ecosystem.js and its looking for the file in botfolder folder.

telostia commented 5 years ago

hm.. that leads to another error:

WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names. WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode TypeError: bot.user.setActivity is not a function

Don't know why its not finding app instance 0. It is in ecosystem.config.js name: 'tipbot', script: './bot/bot.js', cwd: './', instance_id_env: '0', I haven't made any changes to the bot.js yet also.

MSFTserver commented 5 years ago

thats a normal issue with, the config package conflicts with node.js config it looks for so they sorta clash but nothing to worry about the other issue is completely different, probably has to do with setting up the bot properly with discord

telostia commented 5 years ago

ok I just had to remove the yarn.lock and yarn install again. works :D thanks @MSFTserver !