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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decorateReply doesn't working. #83

Open
eouia opened this issue Sep 7, 2020 · 0 comments
Open

decorateReply doesn't working. #83

eouia opened this issue Sep 7, 2020 · 0 comments

Comments

@eouia
Copy link

eouia commented Sep 7, 2020

Thanks for jobs.

I have an issue when I use this module to serve multi-static routes.

import fastifyAutoPush from 'fastify-auto-push'
const fastifyStatic = fastifyAutoPush.staticServe
...
server.register(fastifyStatic, {
  root: path.join(__basename, 'resources'),
  prefix: '/resources/',
  decorateReply: false
})
server.register(fastifyStatic, {
  root: path.join(__basename, 'clients'),
  prefix: '/clients/',
  decorateReply: false
})

When I implement only the resources part, it works well. But the second clients made an error

FastifyError [Error]: The decorator 'sendFile' has already been added!

Then after some seconds, this error would happen also.

Error: ERR_AVVIO_PLUGIN_TIMEOUT: plugin did not start in time:

When I use the original fastify-static, decorateReply:false was the solution. But fastify-auto-push doesn't respect it.

What is the best practice to use this module with multi routes at once?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant