Skip to content

NestJS Microservice: response.status is not a function #16051

@vahidvdn

Description

@vahidvdn

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/nestjs

SDK Version

9.2.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

  1. Use a microservice like MQTT and register an event in the controller (@MessagePattern('yourtopic'))
  2. Create a Guard
  3. Register it globally
  4. Return false inside the guard (it means rejecting the request)
  5. Publish a message to your topic
  6. Then you see the error

Expected Result

App should be able to continue its job without any error.

Actual Result

I get this error:

TypeError: response.status is not a function
    at ExpressAdapter.reply (/Users/vahid/casenio/dnw/tdk-api/node_modules/@nestjs/platform-express/adapters/express-adapter.js:28:22)
    at SentryGlobalFilter.handleUnknownError (/Users/vahid/casenio/dnw/tdk-api/node_modules/@nestjs/core/exceptions/base-exception-filter.js:46:28)
    at SentryGlobalFilter.catch (/Users/vahid/casenio/dnw/tdk-api/node_modules/@nestjs/core/exceptions/base-exception-filter.js:17:25)
    at SentryGlobalFilter.catch (/Users/vahid/casenio/dnw/tdk-api/node_modules/@sentry/nestjs/src/setup.ts:110:49)
    at RpcExceptionsHandler.invokeCustomFilters (/Users/vahid/casenio/dnw/tdk-api/node_modules/@nestjs/microservices/exceptions/rpc-exceptions-handler.js:34:32)
    at RpcExceptionsHandler.handle (/Users/vahid/casenio/dnw/tdk-api/node_modules/@nestjs/microservices/exceptions/rpc-exceptions-handler.js:17:36)
    at RpcProxy.handleError (/Users/vahid/casenio/dnw/tdk-api/node_modules/@nestjs/microservices/context/rpc-proxy.js:24:34)
    at /Users/vahid/casenio/dnw/tdk-api/node_modules/@nestjs/microservices/context/rpc-proxy.js:17:29
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ServerMqtt.handleEvent (/Users/vahid/casenio/dnw/tdk-api/node_modules/@nestjs/microservices/server/server.js:85:32)

Node.js v22.2.0

Metadata

Metadata

Assignees

Labels

Package: nestjsIssues related to the Sentry Nestjs SDK

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions