Skip to content

FST_ERR_REP_ALREADY_SENT on Nest with FastifyAdapter #1557

@da-max

Description

@da-max

Environment

  • node : v22.22.0
  • @nestjs/core : v11.1.16
  • @orpc/nest : v1.14.0
  • @nestjs/platform-fastify : v11.1.21
  • fastify : v5.8.5
  • pino-pretty : 13.1.3

Reproduction

https://stackblitz.com/edit/github-41krfduv-wbaqb8ap

Describe the bug

Hello,

When using Nest and FastifyAdapter, I get a warning (FST_ERR_REP_ALREADY_SENT) with every request made to endpoints that implement the ORPC contract.

Additional context

No response

Logs

[13:59:36 UTC] INFO: request completed
    reqId: "req-5"
    res: {
      "statusCode": 200
    }
    responseTime: 8.419999999998254
[13:59:36 UTC] WARN: Reply was already sent, did you forget to "return reply" in "/auth/signup" (POST)?
    reqId: "req-5"
    err: {
      "type": "FastifyError",
      "message": "Reply was already sent, did you forget to \"return reply\" in \"/auth/signup\" (POST)?",
      "stack":
          FastifyError: Reply was already sent, did you forget to "return reply" in "/auth/signup" (POST)?
              at FastifyError (/home/projects/bnmiqjvrao.github/node_modules/@fastify/error/index.js:42:57)
              at Reply.prototype.send (/home/projects/bnmiqjvrao.github/node_modules/fastify/lib/reply.js:145:26)
              at reply (/home/projects/bnmiqjvrao.github/node_modules/@nestjs/platform-fastify/adapters/fastify-adapter.js:255:29)
              at apply (/home/projects/bnmiqjvrao.github/node_modules/@nestjs/core/router/router-response-controller.js:15:36)
              at <anonymous> (/home/projects/bnmiqjvrao.github/node_modules/@nestjs/core/router/router-execution-context.js:181:48)
      "code": "FST_ERR_REP_ALREADY_SENT",
      "name": "FastifyError",
      "statusCode": 500
    }

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions