TipBot icon indicating copy to clipboard operation
TipBot copied to clipboard

Bot Error - Node App Instance 0 loop [SOLVED]

Open god-father-xuez opened this issue 6 years ago • 12 comments

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 avatar Jan 16 '19 02:01 god-father-xuez

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 avatar Jan 16 '19 02:01 god-father-xuez

Seems like Yimp|NPM is causing this issue?

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

god-father-xuez avatar Jan 16 '19 03:01 god-father-xuez

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

MSFTserver avatar Jan 16 '19 18:01 MSFTserver

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

blademaster-888 avatar Apr 21 '19 06:04 blademaster-888

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

MSFTserver avatar Apr 21 '19 18:04 MSFTserver

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?

blademaster-888 avatar Apr 23 '19 02:04 blademaster-888

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

MSFTserver avatar Apr 23 '19 19:04 MSFTserver

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

blademaster-888 avatar Apr 23 '19 20:04 blademaster-888

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.

blademaster-888 avatar Apr 23 '19 20:04 blademaster-888

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.

blademaster-888 avatar Apr 23 '19 21:04 blademaster-888

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

MSFTserver avatar Apr 23 '19 23:04 MSFTserver

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

blademaster-888 avatar Apr 24 '19 01:04 blademaster-888