mia-platform / crud-service

A lightweight application to expose restful CRUD API over HTTP interface
https://docs.mia-platform.eu/docs/how_to/crud_service/crud_oss_usage
Apache License 2.0
44 stars 4 forks source link

AvvioError [Error]: Plugin did not start in time #312

Open elmalakomar opened 6 months ago

elmalakomar commented 6 months ago

Hi, with the version 6.5.2 and 7.0.2 I have the crud-service that at startup is returning this error and then restart. What could be the cause of this?

/home/node/app/node_modules/fastify/fastify.js:627
        ? appendStackTrace(err, new AVVIO_ERRORS_MAP[err.code](err.message))
                                ^
FastifyError [Error]: fastify-plugin: Plugin did not start in time: 'loadModels-auto-3'. You may have forgotten to call 'done' function or to resolve a Promise
    at manageErr (/home/node/app/node_modules/fastify/fastify.js:627:33)
    at /home/node/app/node_modules/fastify/fastify.js:613:11
    at Object._encapsulateThreeParam (/home/node/app/node_modules/avvio/boot.js:562:7)
    at Boot.timeoutCall (/home/node/app/node_modules/avvio/boot.js:458:5)
    at Boot.callWithCbOrNextTick (/home/node/app/node_modules/avvio/boot.js:440:19)
    at release (/home/node/app/node_modules/fastq/queue.js:166:16)
    at Object.resume (/home/node/app/node_modules/fastq/queue.js:98:7)
    at /home/node/app/node_modules/avvio/boot.js:174:18
    at /home/node/app/node_modules/avvio/plugin.js:275:7
    at done (/home/node/app/node_modules/avvio/plugin.js:200:5) {
  code: 'FST_ERR_PLUGIN_TIMEOUT',
  statusCode: 500,
  cause: AvvioError [Error]: Plugin did not start in time: 'loadModels-auto-3'. You may have forgotten to call 'done' function or to resolve a Promise
      at Timeout._onTimeout (/home/node/app/node_modules/avvio/plugin.js:122:19)
      at listOnTimeout (node:internal/timers:573:17)
      at process.processTimers (node:internal/timers:514:7) {
    code: 'AVV_ERR_READY_TIMEOUT',
    fn: <ref *1> [AsyncFunction: loadModels] {
      default: [Circular *1],
      [Symbol(skip-override)]: true,
      [Symbol(fastify.display-name)]: 'loadModels-auto-3',
      [Symbol(plugin-meta)]: { name: 'loadModels-auto-3' }
    }
  }
}
Node.js v20.12.2
ianFar96 commented 6 months ago

Hi @elmalakomar, you are seeing this error because the CRUD service is struggling to load the provided collections. This means you should give more resources to the service to avoid hitting the startup timeout from fastify.

elmalakomar commented 5 months ago

Hi @ianFar96 , I added a lot of resources but I'm still getting the same error. It's possible in some way to increase the waiting time in order to avoid hitting the startup timeout?