Closed Dragonizedpizza closed 3 years ago
also, when I try to use the Mongoose.js example in the develop branch, I get this error: MongooseError: Operation giveaways.insertOne()
buffering timed out after 10000ms
Hi, whenever a user deletes the giveaway message, my console gets spammed. It gets spammed with Discord API errors saying unknown message. This would continue until the giveaway time has finished. Any idea how to stop this?
npm i Androz2091/discord-giveaways#develop
should have the fix, will get released with the next version
also, when I try to use the Mongoose.js example in the develop branch, I get this error: MongooseError: Operation
giveaways.insertOne()
buffering timed out after 10000ms
What about this?
https://github.com/Automattic/mongoose/issues/9732 Look through this
@Nico105 none worked
Which line does even cause this error? Because in the example .insertOne()
does not get used. The error in the code of the "mongoose" package right?
I'll send both the errors.
(node:20788) UnhandledPromiseRejectionWarning: MongooseError: Operation `giveaways.insertOne()` buffering timed out after 10000ms at Timeout.<anonymous> (C:\Users\akyra\Desktop\Bots\DragonNight\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) (Use `node --trace-warnings ...` to show where the warning was created) (node:20788) 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:20788) [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.
(node:20788) UnhandledPromiseRejectionWarning: MongooseError: Operation `giveaways.findOneAndUpdate()` buffering timed out after 10000ms at Timeout.<anonymous> (C:\Users\akyra\Desktop\Bots\DragonNight\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:20788) 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)
Which line does even cause this error? Because in the example
.insertOne()
does not get used. The error in the code of the "mongoose" package right?
@Nico105 yes I think
mongoose.connect(config.mongouri, { useFindAndModify: false });
is it still there if you use the connect method without your custom options?
@Nico105 I connect through this: mongoose.connect(config.mongouri, { useNewUrlParser: true, useUnifiedTopology: true, useFindAndModify: false, });
As said try it with the default (my) one
(node:24544) UnhandledPromiseRejectionWarning: MongooseError: Operation `giveaways.insertOne()` buffering timed out after 10000ms at Timeout.<anonymous> (C:\Users\akyra\Desktop\Bots\DragonNight\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:24544) 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:24544) [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.
@Nico105 same error.
.catch(error => console.error(error));
add this after .connect()
and btw are you sure the IP you're connecting from is whitelisted?
I switched on allow connections from everywhere @Nico105...
"was resolved by removing the node_module folder, *.json (=package) files and reinstalling the mongoose module." https://www.codegrepper.com/code-examples/csharp/MongooseError%3A+Operation+%60warns.findOne%28%29%60+buffering+timed+out+after+10000ms
@Nico105 I don't have a folder with the text .json in it lmao
That's not the folder, the package.lock.json is a file
The folder is "node_modules" if you misread that
Delete both
then run npm i
the instructions aren't very clear but ok
package.lock.json
filenode_modules
foldernpm i
You could be glad I'm even trying to help because this is not a issue of discord-giveaways
in the first place...
yes yes, I am very grateful :)
Operation `giveaways.insertOne()` buffering timed out after 10000ms
@Nico105 didn't work ):
- Delete
package.lock.json
file- Delete
node_modules
foldernpm i
You could be glad I'm even trying to help because this is not a issue of
discord-giveaways
in the first place...
Also, it kinda is cos the examples in the discord-giveaways package is invalid.
- Delete
package.lock.json
file- Delete
node_modules
foldernpm i
You could be glad I'm even trying to help because this is not a issue of
discord-giveaways
in the first place...Also, it kinda is cos the examples in the discord-giveaways package is invalid.
Wrong, the example code is 100% valid and functioning, what is wrong here are just mongoDB/mongoose connection/network/setting issues, discord-giveaways
is not the fault of this, the error clearly said that it was in the mongoose folder and from what i found about "buffering", what it says in your error, is that you pretty much can "use" mongoose things before you connected to the actual DB but only for a certain time => "timeout after 10000ms", because it couldn't connect even after the buffer time.
It is not the example codes fault, for enough people it just worked fine first try.
As said it has smth to do with mongoDB configuration/access/perms or smth
Don't expect that we can "magically" change smth in the example code and make it work for you.
Things just don't work the same on different PC's on different networks, on differents settings/configuration
It would't even have gotten merged into the develop branch if it wouldn't have functioned.
Uh- Ok then-
do I still get help?
If someone knows a solution and sees this, then such a person will very likely tell it to you, but because this is just a discord.js giveaway module not too many know-solution persons will see this, so you should start searching elsewhere for answers, you could maybe make a issue on the github mongoose page or find a discord server or some forum which deals with mongo errors or just ask on stackoverflow. :)
Btw what you could try is making a completely new mongoDB project/cluster with all default settings (exept allow all IPs) and connect to that one to test
alright, ty!
Have you fixed this @Dragonizedpizza ? I have added a connection string below to try I had this error and this fixed for me.
mongoose.connect(process.env.MONGO_DB, { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true, useFindAndModify: false });
@MaximKing1 nope.
Forgot about this.
The problem was that I was using MongoDB's free cluster, which supports only one connection at a time.
Hi, whenever a user deletes the giveaway message, my console gets spammed. It gets spammed with Discord API errors saying unknown message. This would continue until the giveaway time has finished. Any idea how to stop this?