Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting AVV_ERR_READY_TIMEOUT when sart the app #878

Open
iwangunawan29 opened this issue May 8, 2023 · 1 comment
Open

getting AVV_ERR_READY_TIMEOUT when sart the app #878

iwangunawan29 opened this issue May 8, 2023 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@iwangunawan29
Copy link

iwangunawan29 commented May 8, 2023

馃挰 Question here

AVV_ERR_READY_TIMEOUT

getting AVV_ERR_READY_TIMEOUT when sart the app, detail error :

AvvioError [Error]: Plugin did not start in time: 'fastifyDecorators'. You may have forgotten to call 'done' function or to resolve a Promise
    at Timeout._onTimeout (/Users/Workspace/app/node_modules/avvio/plugin.js:122:19)
    at listOnTimeout (node:internal/timers:564:17)
    at processTimers (node:internal/timers:507:7) {
  code: 'AVV_ERR_READY_TIMEOUT',
  fn: <ref *1> [AsyncFunction (anonymous)] {
    default: [Circular *1],
    fastifyDecorators: [Circular *1],
    [Symbol(skip-override)]: true,
    [Symbol(fastify.display-name)]: 'fastifyDecorators',
    [Symbol(plugin-meta)]: { fastify: '^3.0.0 || ^4.0.0', name: 'fastifyDecorators' }
  }
}

and following code to start app

// server.ts
export async function initServer(): Promise<FastifyInstance> {
  const server: FastifyInstance = Fastify({
    logger: false,
    pluginTimeout: 30000,
  }).withTypeProvider<TypeBoxTypeProvider>();

  await registerPlugins(server);

  await registerHooks(server);

  await registerControllers(server);

  await registerOtherHandlers(server);

  return server;
}
// register plugin
export const registerPlugins = async (server: FastifyInstance) => {
  await server.register(fastifyRequestContext, {
    defaultStoreValues: {
      requestId: '',
      userId: '',
      userToken: '',
      startTime: Date.now(),
    },
  });

  await server.register(cors, { origin: '*' });
  await server.register(helmet, { global: true });
  await server.register(multer.contentParser);
  await server.register(fasitfySwagger, {
    swagger,
      host: HOST,
      schemes: SCHEMES,
      consumes: ['application/json'],
      produces: ['application/json'],
      securityDefinitions: {
        Authorization: {
          type: 'apiKey',
          name: 'Authorization',
          in: 'header',
        },
        'X-ID': {
          type: 'apiKey',
          name: 'X-ID',
          in: 'header',
        },
      },
      security: [
        {
          Authorization: [],
        },
        {
          'X-ID': [],
        },
      ],
    },
  });

  await server.register(fastifySwaggerUI, {
    routePrefix: '/app',
    uiConfig: {
      docExpansion: 'none',
      deepLinking: false,
      persistAuthorization: true,
    },
    uiHooks: {
      onRequest: function onRequest(_, __, next) {
        next();
      },
      preHandler: function preHandler(_, __, next) {
        next();
      },
    },
    staticCSP: true,
    transformStaticCSP: (header) => header,
    transformSpecification: (swaggerObject) => swaggerObject,
    transformSpecificationClone: true,
  });

Your Environment

  • node version: 18
  • fastify version: >=4.0.0
  • os: Mac
  • any other relevant information
@iwangunawan29 iwangunawan29 added the help wanted Extra attention is needed label May 8, 2023
@iwangunawan29 iwangunawan29 changed the title Help getting AVV_ERR_READY_TIMEOUT when sart the app May 8, 2023
@climba03003
Copy link
Member

Can you full reproducible code that people can run directly?
Your error state fastifyDecorators and I didn't see it inside your provided code.
Further more, I didn't know what is multer.contentParser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants