Swagger Integration

I have an Node application that I created using Swagger generator and it uses the Swagger, Swagger Express MW. Using the Express config setup I’m trying to integrate Sentry with my App but it doesn’t work. I’ve followed the steps and when I trow an error, it does not get sent to Sentry. Here’s my app.js file:

    'use strict';
// Require and use dontenv files

const SwaggerExpress = require('swagger-express-mw');
const app = require('express')();
const auth = require('./api/helpers/auth');
const cors = require('cors');
module.exports = app; // for testing
// Sentry
const Sentry = require('@sentry/node');
Sentry.init({ dsn: 'https://something@sentry.io/1472008' });

var config = {
  appRoot: __dirname, // required config
  swaggerSecurityHandlers: {
    Bearer: auth.verifyToken

SwaggerExpress.create(config, function(err, swaggerExpress) {
  if (err) { throw err; }

  // The request handler must be the first middleware on the app

  // The error handler must be before any other error middleware

  // Optional fallthrough error handler
  app.use(function onError(err, req, res, next) {
    // The error id is attached to `res.sentry` to be returned
    // and optionally displayed to the user for support.
    res.statusCode = 500;
    res.end(res.sentry + "\n");

  // install middleware

  // setup cors

  var port = process.env.PORT || 10010;

  if (swaggerExpress.runner.swagger.paths['/hello']) {
    console.log('try this:\ncurl' + port + '/hello?name=Scott');

Any ideas on how I could make this work?