Safemoon-Protocol / Discord-Bot

SafeMoon's Discord Bot.
GNU General Public License v3.0
117 stars 36 forks source link

Result of: node --trace-warnings ... #16

Closed jimango closed 3 years ago

jimango commented 3 years ago

Question:

What is this and how can I possible solve this?

localhost:~/DiscordBot/Safemoon-Bot$ node --trace-warnings ...
internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module '/*****/****/DiscordBot/Safemoon-Bot/...'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
reecebenson commented 3 years ago

Hi @jimango,

You'll find it easier to run npm run start instead of trying to utilise node, or use npm run dev:local to run it behind nodemon. There have been some package updates, so make sure to install the latest dependencies with npm install.

Cheers

jimango commented 3 years ago

I see. I did npm run start.

But in the log I can see things like this:

[RUNNER]: [1619020776] "update-presence" was executed.
(node:3328591) UnhandledPromiseRejectionWarning: MongooseServerSelectionError: getaddrinfo EAI_AGAIN db
    at NativeConnection.Connection.openUri (/***/***/DiscordBot/Safemoon-Bot/node_modules/mongoose/lib/connection.js:845:32)
    at /***/***/DiscordBot/Safemoon-Bot/node_modules/mongoose/lib/index.js:348:10
    at /***/***/DiscordBot/Safemoon-Bot/node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:5
    at new Promise (<anonymous>)
    at promiseOrCallback (/***/***/DiscordBot/Safemoon-Bot/node_modules/mongoose/lib/helpers/promiseOrCallback.js:30:10)
    at Mongoose._promiseOrCallback (/***/***/DiscordBot/Safemoon-Bot/node_modules/mongoose/lib/index.js:1152:10)
    at Mongoose.connect (/***/***/DiscordBot/Safemoon-Bot/node_modules/mongoose/lib/index.js:347:20)
    at module.exports (/***/***/DiscordBot/Safemoon-Bot/src/mongo.js:6:18)
    at Object.run (/***/***/DiscordBot/Safemoon-Bot/src/jobs/pricewatch-single.js:20:11)
    at Timeout._onTimeout (/***/***/DiscordBot/Safemoon-Bot/src/jobs.js:39:17)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3328591) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3328591) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Running command: price
(node:3328591) UnhandledPromiseRejectionWarning: MongooseError: Operation `setups.find()` buffering timed out after 10000ms
    at Timeout.<anonymous> (/***/***/DiscordBot/Safemoon-Bot/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:185:20)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)
(node:3328591) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:3328591) UnhandledPromiseRejectionWarning: MongooseError: Operation `setups.find()` buffering timed out after 10000ms
    at Timeout.<anonymous> **(/***/***/DiscordBot/Safemoon-Bot/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:185:20)**
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)
(node:3328591) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
[RUNNER]: [1619020806] "update-presence" was executed.

Since there was a line telling me how to pin down the warning message I used that command node --trace-warnings to extract it.

If this log looks good to you I guess there is no issue. :) Im running this without Docker (btw).

EDIT: the icons of the bot are plain red and green colour, not the icon in chat reply from bot.. not sure if there is a connection there?

reecebenson commented 3 years ago

Hi @jimango,

If you're running without Docker, and have Mongo installed on the machine you're running the bot from, you'll probably want to change your config.json to have mongoPath set to: mongodb://localhost:27017/ which should suppress & fix the error you're seeing. I updated it so that it uses db, which is the Docker container's name. I should probably update the README to highlight that!

Cheers

reecebenson commented 3 years ago

the icons of the bot are plain red and green colour, not the icon in chat reply from bot.. not sure if there is a connection there?

I didn't have enough time today to extract the emoji's from the guild they're in, I'll get around to that sometime this week or weekend.

jimango commented 3 years ago

Cheers.

Thank you very much!