-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error Plugin did not start in time: '@fastify/mongodb'. You may have forgotten to call 'done' function or to resolve a Promise #224
Comments
This indicates that the connection to the db could not be established, as the plugin never resolves. |
I have configured the db on mongo lap correctly because network open is 0.0.0.0 and user + password is correct. But I don't understand why it doesn't work |
@Uzlopak But when working on localhost:27017 it runs again, can you help me? I just learned about fastify. |
I am closing the issue because there is no indication the problem related to From my point of view, it clearly you have some connection error to your database, please try the same connection string with |
I am 100% sure the error is from @fastify/mongodb Here is the code I run perfectly fine with mongoose
and here is the code that runs with fastify
The result is the same as the error I posted |
was about to say that in your first code version you are mixin async and next, the latter version of the code should be fine. I think it may be a firewall or something.
|
I still get the same error. while testing with mongoose new file index.js it works. If it's due to a firewall, mongoose will also not work. Because I am running on the same local machine environment. |
Run -> ERROR ===> AvvioError [Error]: Plugin did not start in time: 'databaseConnect-auto-2'. You may have forgotten to call 'done' function or to resolve a Promise |
I suggest you to try the official package import { MongoClient } from 'mongodb'
const client = new MongoClient('mongodb+srv://demo:demo@cluster0.m9frj.mongodb.net/')
await client.connect() |
Thank. I'm just testing to find the problem and fix it. |
ERROR
A plugin does not fail
|
You are not doing the same as this plugin, and you ignore the connection state by resolving the plugin immediately.
|
I tried but doing the above will get an error. |
So, you would need to measure how much time you need to connect to the MongoDB Altas. Increase the pluginTimeout to 30s or longer, if a single connection required more than 30s than it is absolutely something wrong in your network stack. |
What is network classification error and how to fix it. You can specify the way or area to learn how to fix it |
Thanks I know how to solve the problem maybe this is it. pluginTimeout |
The MongoDB Altas connection consist too many steps.
Normally, a connection will be resolved within 1 second. More than 10 second will exist in a slow network. |
Thank you very much. after fixing with options with pluginTimeout server it is working.
|
Prerequisites
Fastify version
4.x
Plugin version
^6.0.1
Node.js version
16.0.9
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
ventura 13.5.2
Description
Why does connect localhost:27017 work.
but connect to mongo with the address mongodb+srv://user:pass@cluster0.m9frj.mongodb.net/
then get an error
Plugin file
Plugin did not start in time: '@fastify/mongodb'. You may have forgotten to call 'done' function or to resolve a Promise
Steps to Reproduce
Expected Behavior
The text was updated successfully, but these errors were encountered: