-
Notifications
You must be signed in to change notification settings - Fork 49
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
Throw fastify-mongodb error instead of avvio error #134
Comments
I think we need to pass a custom Wdyt? Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
I think this is problem of fastify.register that has timeout time when register plugin, if i read the error correctly. It would be best to catch the error than make connectTimeoutMS. I think adding custom |
Inside the plugin, it already forward the error to As the |
Anyone that would like to make PR request could make it. I tried to make test case and the code and struggling with that. I dont know how to make error case like make making the mongo to timeout I am still very new in open project like this. The code still a bit advanced for me |
I'm using fastify-autoload to load my plugins and one of the files contains:
for some reason its failing to load with the following error:
Giving that it worked before. |
@ihadabs If it throw about For this issue, I have tested both |
Had the same issue just had to debug more and my mongo docker container wasn't bound properly lol |
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 how to fix it
|
This indicates that the connection to the db could not be established, as the plugin never resolves. |
Prerequisites
Fastify version
3.20.0
Plugin version
4.0.0
Node.js version
15.13.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
20.04
Description
I am trying to connecting to mongodb with url like usual. I wonder why its timeout and especially by this module "avvio". Turns out i forget to whitelist my ip address and thats why i was rejected. But, i think would be good for fastify-mongodb to catch this timeout error when connecting db
rror: ERR_AVVIO_PLUGIN_TIMEOUT: plugin did not start in time: /home/wwww/product/node_modules/fastify-mongodb/index.js. You may have forgotten to call 'done' function or to resolve a Promise at Timeout._onTimeout (/home/wwwww/product/node_modules/avvio/plugin.js:123:19) at listOnTimeout (node:internal/timers:557:17) at processTimers (node:internal/timers:500:7) { code: 'ERR_AVVIO_PLUGIN_TIMEOUT', fn: <ref *1> [Function: fastifyMongodb] { default: [Circular *1], fastifyMongodb: [Circular *1], [Symbol(skip-override)]: true, [Symbol(fastify.display-name)]: 'fastify-mongodb', [Symbol(plugin-meta)]: { fastify: '>=1.0.0', name: 'fastify-mongodb' } } }
Steps to Reproduce
Expected Behavior
Its should be mongodb error but avvio catch it instead
The text was updated successfully, but these errors were encountered: