You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm submitting a question about how to use this project
I am connecting to mongodb during main startup of the project. But as initially mongodb is not available it throws below error. How do I make it retry in case of mongodb is not available. I tried posting on stackoverflow and also tried checking for developers at work portals but seems none of them are able to fix this.
I am unable to find any documentation for the same anywhere.
(node:33) UnhandledPromiseRejectionWarning: MongoServerSelectionError: getaddrinfo EAI_AGAIN example-mongodb-svc
at Timeout._onTimeout (/usr/src/app/node_modules/connect-mongo/node_modules/mongodb/lib/core/sdam/topology.js:439:30)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:33) 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:33) [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.
Can you please help on how to use autoconnect option so that I don't see this error but it will try to reconnect to mongodb so that once mongodb is up and running it can continue...?
The text was updated successfully, but these errors were encountered:
Moreover I am also unable to find documentation on how to handle exception. If I could handle the exception then I also I would have tried to create mongo db session again from catch block.
Connecting to mongodb and connection state handling it outside the scope of the liv (or even express-session). Mongoose seems to have functionality to help you manage the connection retry and heartbeat interval. You can take a look into that. https://mongoosejs.com/docs/api/mongoose.html#mongoose_Mongoose-connect
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I'm submitting a question about how to use this project
I am connecting to mongodb during main startup of the project. But as initially mongodb is not available it throws below error. How do I make it retry in case of mongodb is not available. I tried posting on stackoverflow and also tried checking for developers at work portals but seems none of them are able to fix this.
I am unable to find any documentation for the same anywhere.
https://stackoverflow.com/questions/70410326/connect-mongo-auto-reconnect
Can you please help on how to use autoconnect option so that I don't see this error but it will try to reconnect to mongodb so that once mongodb is up and running it can continue...?
The text was updated successfully, but these errors were encountered: