in file packages/bautajs-fastify/src/expose-routes.ts on line 49 there is a deprecated code that fastify suggest to remove "FastifyDeprecation: Modifying the "reply.sent" property is deprecated. Use the "reply.hijack()" method instead."
Besides we're "duplicating" the intended behavior by already using reply.hijack(); in the line 47.
Also using reply.sent leads to an error instead of avoiding re-sending the response (fastify/lib/reply:107):
note that at this point, reply.hijack(); has already set the value this[kReplyHijacked]to true so the if at line 106 will always be true and will throw the error
ERROR (95356): Response has been sent to the requester, but the promise threw an error
reqId: "req-1"
error: {
"name": "FastifyError",
"code": "FST_ERR_REP_ALREADY_SENT",
"message": "Reply was already sent, did you forget to \"return reply\" in \"/v1/conversations\" (POST)?"
}
ERROR (95356): Promise errored, but reply.sent = true was set
reqId: "req-1"
err: {
"type": "FastifyError",
"message": "Reply was already sent, did you forget to \"return reply\" in \"/v1/conversations\" (POST)?",
"stack":
FastifyError: Reply was already sent, did you forget to "return reply" in "/v1/conversations" (POST)?
at _Reply.set [as sent] (/Users/rodrigor/Documents/secure-gpt/node_modules/fastify/lib/reply.js:107:15)
at Object.<anonymous> (/Users/rodrigor/Documents/secure-gpt/node_modules/@axa/bautajs-fastify/src/expose-routes.ts:101:19)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
"code": "FST_ERR_REP_ALREADY_SENT",
"name": "FastifyError",
"statusCode": 500
}
in file packages/bautajs-fastify/src/expose-routes.ts on line 49 there is a deprecated code that fastify suggest to remove "FastifyDeprecation: Modifying the "reply.sent" property is deprecated. Use the "reply.hijack()" method instead."
Besides we're "duplicating" the intended behavior by already using reply.hijack(); in the line 47. Also using reply.sent leads to an error instead of avoiding re-sending the response (fastify/lib/reply:107): note that at this point,
reply.hijack();
has already set the valuethis[kReplyHijacked]
totrue
so theif
at line 106 will always be true and will throw the error