siemah · GitHub

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure it has not already been reported

Fastify version

3.20.2

Plugin version

3.0.0

Node.js version

12.22.3

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

10.15.7

Description

I tried to call preParsing hook using the async way as suggested in the documentation:

fastify.addHook('preParsing', async (request, reply, payload) => {
  // Some code
  return payload;
})

and when i take a look at my terminal i found this warning:

(node:37541) [FSTDEP004] FastifyDeprecation: You are using the legacy preParsing hook signature. Use the one suggested in the documentation instead.
server listening on http://[::1]:4321

then i tried the other way:

fastify.addHook('preParsing',  (request, reply, payload, done) => {
  // Some code
  return done(null, payload);
})

i didnt find any warning.

Steps to Reproduce

  • Create a fastify server
  • Add preParsing hook using the code above

Expected Behavior

No response

Read the original on github.com ↗