Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Express Integration is not exported #11925

Closed
3 tasks done
Igor-Lopes opened this issue May 7, 2024 · 3 comments
Closed
3 tasks done

Express Integration is not exported #11925

Igor-Lopes opened this issue May 7, 2024 · 3 comments

Comments

@Igor-Lopes
Copy link

Igor-Lopes commented May 7, 2024

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

5.3.0

Framework Version

express 4.15.13

Link to Sentry event

No response

SDK Setup

  Sentry.init({
    dsn: 'https://',
    integrations: [
      new Sentry.Integrations.Http({ tracing: true }),
      new Sentry.Integrations.Express({ app }),
      nodeProfilingIntegration()
    ],

    // Performance Monitoring
    tracesSampleRate: 1.0, //  Capture 100% of the transactions
    // Set sampling rate for profiling - this is relative to tracesSampleRate
    profilesSampleRate: 1.0
  })

  app.use(Sentry.Handlers.requestHandler())
  app.use(Sentry.Handlers.tracingHandler())
  app.use(Sentry.Handlers.errorHandler()) 

Steps to Reproduce

  1. Try to setup Sentry for Express.js just like instructed from Sentry Dashboard
  2. You'll get this error: TypeError: Sentry.Integrations.Express is not a constructor
  3. If you remove this line new Sentry.Integrations.Express({ app }), app will not break.

Expected Result

Sentry Express Integration should work.

Actual Result

TypeError: Sentry.Integrations.Express is not a constructor.

Captura de Tela 2024-05-06 às 21 27 43

It seems like Express Integration is not exported. You can easily check this by calling console.log(Sentry). Express is not available under Integrations objects. That's why new Sentry.Integrations.Http({ tracing: true }) will work, but new Sentry.Integrations.Express({ app }) won't. If you see the result of this log, Http integration is exported, thus, working.

Captura de Tela 2024-05-06 às 21 27 07
@mydea
Copy link
Member

mydea commented May 7, 2024

Hello,

you are using SDK version 5, which is quite old. All our docs etc. are for the current version of the SDK (v7 or very soon v8). Please update your SDK. You can find help on migrating to newer SDK versions here: https://docs.sentry.io/platforms/javascript/guides/node/migration/

@mydea mydea closed this as not planned Won't fix, can't repro, duplicate, stale May 7, 2024
@Igor-Lopes
Copy link
Author

Sorry I've thought it was installed the latest version. However, if you run yarn such as instructed on sentry website, it will install version 5 by default. You have to specify the latest version to force install it.

@Igor-Lopes
Copy link
Author

Igor-Lopes commented May 7, 2024

@mydea I think Sentry Dashboard should be updated to follow this guide:
https://docs.sentry.io/platforms/javascript/guides/express/migration/v7-to-v8/#important-changes

Currently on Sentry Dashboard:


Sentry.init({
  dsn: "https://",
  integrations: [
    // enable HTTP calls tracing
    new Sentry.Integrations.Http({ tracing: true }),
    // enable Express.js middleware tracing
    new Sentry.Integrations.Express({ app }),
    nodeProfilingIntegration(),
  ],
  // Performance Monitoring
  tracesSampleRate: 1.0, //  Capture 100% of the transactions
  // Set sampling rate for profiling - this is relative to tracesSampleRate
  profilesSampleRate: 1.0,
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants