Sentry not capturing Koa Websocket Errors

57 views Asked by At
  • Using Koa framework with Websockets.
  • Sentry captures errors in Express middleware but not within websocket communication.
  • Errors are caught and logged inside the websocket message handler but not sent to Sentry.

Like I tried

const Sentry = require('@sentry/node');

try{
    ...
} catch(error){
   console.log(error);
   Sentry.captureException(error);
}

I was expecting that Sentry to capture and report any errors thrown during websocket communication. But it logs the error but Sentry.captureException(error) is not working.

I have read somewhere that "WebSocket events are handled separately from the Koa middleware stack." But didn't find the solution. Please help me with this.

0

There are 0 answers