fastify-response-time icon indicating copy to clipboard operation
fastify-response-time copied to clipboard

[FSTDEP002] FastifyDeprecation: 3.x

Open niksmac opened this issue 5 years ago • 2 comments

[FSTDEP002] FastifyDeprecation: You are accessing the Node.js core response object via "reply.res", Use "reply.raw" instead.

(node:52693) UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at Object.<anonymous> (/Code/node_modules/fastify-response-time/index.js:60:31)
    at next (/Code/node_modules/fastify/lib/hooks.js:202:34)

niksmac avatar Oct 12 '20 08:10 niksmac

I have errors too:

(node:2518245) [FSTDEP002] FastifyDeprecation: You are accessing the Node.js core response object via "reply.res", Use "reply.raw" instead.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2518245) UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)                                         
    at Object.<anonymous> (/media/nvme/pro/hn/hn-cache/node_modules/fastify-response-time/index.js:60:31)
    at next (/media/nvme/pro/hn/hn-cache/node_modules/fastify/lib/hooks.js:206:34)
    at onSendHookRunner (/media/nvme/pro/hn/hn-cache/node_modules/fastify/lib/hooks.js:220:3)
    at onSendHook (/media/nvme/pro/hn/hn-cache/node_modules/fastify/lib/reply.js:359:5)
    at handleError (/media/nvme/pro/hn/hn-cache/node_modules/fastify/lib/reply.js:553:5)
    at onErrorHook (/media/nvme/pro/hn/hn-cache/node_modules/fastify/lib/reply.js:498:5)
    at _Reply.Reply.send (/media/nvme/pro/hn/hn-cache/node_modules/fastify/lib/reply.js:118:5)
    at defaultErrorHandler (/media/nvme/pro/hn/hn-cache/node_modules/fastify/fastify.js:74:9)
    at handleError (/media/nvme/pro/hn/hn-cache/node_modules/fastify/lib/reply.js:527:20)
(node:2518245) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use th
e CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)                     
(node:2518245) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

gustawdaniel avatar Dec 15 '20 14:12 gustawdaniel

I've made an updated version for Fastify 3 - https://github.com/pearofducks/fastify-request-timing

pearofducks avatar May 15 '21 10:05 pearofducks