SwitchbladeBot / switchblade

The open source Discord bot that solves all of your problems.
https://switchblade.xyz/
BSD 4-Clause "Original" or "Old" License
425 stars 220 forks source link

Doesn't run without a database/lavalink connection #175

Closed bdnbje closed 6 years ago

bdnbje commented 6 years ago

I tried running it but it gives me these errors.

    at module.exports (/home/pi/switchblade/node_modules/mongodb/lib/url_parser.js:17:21)
    at connect (/home/pi/switchblade/node_modules/mongodb/lib/mongo_client.js:880:3)
    at connectOp (/home/pi/switchblade/node_modules/mongodb/lib/mongo_client.js:270:3)
    at executeOperation (/home/pi/switchblade/node_modules/mongodb/lib/utils.js:420:24)
    at MongoClient.connect (/home/pi/switchblade/node_modules/mongodb/lib/mongo_client.js:261:10)
    at Promise (/home/pi/switchblade/node_modules/mongoose/lib/connection.js:436:12)
    at new Promise (<anonymous>)
    at NativeConnection.Connection.openUri (/home/pi/switchblade/node_modules/mongoose/lib/connection.js:433:19)
    at Mongoose.connect (/home/pi/switchblade/node_modules/mongoose/lib/index.js:208:15)
    at MongoDB.connect (/home/pi/switchblade/src/database/mongo/MongoDB.js:15:21)
    at Switchblade.initializeDatabase (/home/pi/switchblade/src/Switchblade.js:207:19)
    at new Switchblade (/home/pi/switchblade/src/Switchblade.js:23:10)
    at Object.<anonymous> (/home/pi/switchblade/index.js:7:16)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
(node:489) ExperimentalWarning: The http2 module is an experimental API.
[Discord] Logged in successfully!
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND undefined undefined:80
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:50:26)
Emitted 'error' event at:
    at LavalinkNode.node.on.error (/home/pi/switchblade/node_modules/discord.js-lavalink/src/lib/PlayerManager.js:69:47)
    at LavalinkNode.emit (events.js:182:13)
    at LavalinkNode._error (/home/pi/switchblade/node_modules/discord.js-lavalink/src/lib/LavalinkNode.js:222:14)
    at WebSocket.emit (events.js:182:13)
    at ClientRequest.req.on (/home/pi/switchblade/node_modules/discord.js-lavalink/node_modules/ws/lib/websocket.js:535:10)
    at ClientRequest.emit (events.js:182:13)
    at Socket.socketErrorListener (_http_client.js:382:9)
    at Socket.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
[nodemon] app crashed - waiting for file changes before starting...
Doges commented 6 years ago

Which exactly node version are you using?

bdnbje commented 6 years ago

I'm running 10.5.0

pi@raspberrypi:~ $ nodejs --version
v10.5.0
davipatury commented 6 years ago

The problem isn't your node version, it's the MongoDB and Lavalink connection. I will try to fix it asap.

jaxxibae commented 6 years ago

@JiMMYBOOi you're sure that you have all the environment variables defined in your .env, right?

jaxxibae commented 6 years ago

(continuing) because I'm running Switchblade on node v10.5.0 too and it's working as intended

bdnbje commented 6 years ago

I'm using mongodb 2.4.14 and this is my .env

DISCORD_TOKEN=XXXXXXX
PREFIX=d!
pedrofracassi commented 6 years ago

The errors you're getting are related to some required environment variables that are missing. We're working on a fix that will allow the bot to run without Lavalink, but you'll still need to set the MONGODB_URI anyways.

bdnbje commented 6 years ago

how do I find the MONGODB_URI ?

Doges commented 6 years ago

You need to create a MONGODB database first, here an example of URI: mongodb://username:password@host1:port

bdnbje commented 6 years ago

I added a mongodb uri now I'm getting this error.

[ErrorLog] { MongoError: Server at 127.0.0.1:27017 reports wire version 0, but this version of Node.js Driver requires at least 2 (MongoDB2.6).
    at /home/pi/switchblade/node_modules/mongodb-core/lib/topologies/server.js:379:39
    at /home/pi/switchblade/node_modules/mongodb-core/lib/connection/pool.js:544:18
    at process._tickCallback (internal/process/next_tick.js:61:11)
  name: 'MongoError',
  message:
   'Server at 127.0.0.1:27017 reports wire version 0, but this version of Node.js Driver requires at least 2 (MongoDB2.6).' }
jaxxibae commented 6 years ago

Upgrade MongoDB

bdnbje commented 6 years ago

it says I'm on wire version 0 ? { MongoError: Server at 127.0.0.1:27017 reports wire version 0,

jaxxibae commented 6 years ago

you need to upgrade your MongoDB from 2.6 to 3.6