fastify / fastify

Fast and low overhead web framework, for Node.js

Home Page:https://www.fastify.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

incorrect plugin identified for timeout

mcollina opened this issue · comments

In this following case we identify the wrong plugin in the timeout error:

const Fastify = require('./fastify');

const app = Fastify({ logger: true, pluginTimeout: 1000 });

function myPlugin(fastify, opts) {
  fastify.decorate('myPlugin', 'myPlugin');
  // we are not calling the callback on purpose
}

app.register(async function a (fastify, opts) {
  await fastify.register(myPlugin)
})

app.listen({ port: 3000 }, (err) => {
  console.log(err);
})

Specifically, we identify a as timing out.

This might be an avvio bug.

Note that there is a crash with that code as well, which is fixed in fastify/avvio#252.