sentry-javascript: eslint(import/namespace): error 'BrowserTracing' not found in imported namespace 'Sentry'

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/remix

SDK Version

7.84.0

Framework Version

Remix 2.1.0

Link to Sentry event

n/a

SDK Setup

  Sentry.init({
    dsn: window.SENTRY_DSN,
    environment: window.SENTRY_ENVIRONMENT,
    tunnel: "/api/internal/sentry_proxy",
    tracesSampleRate: 1,
    replaysSessionSampleRate: 0.1,
    replaysOnErrorSampleRate: 1,

    beforeSend(event) {
      if (event.exception) {
        errorHook(event)
      }
      return event
    },

    integrations: [
      new Sentry.BrowserTracing({
        routingInstrumentation: Sentry.remixRouterInstrumentation(
          useEffect,
          useLocation,
          useMatches,
        ),
      }),
      new Sentry.Replay({
        maskAllText: false,
        maskAllInputs: false,
        blockAllMedia: false,
      }),
    ],
  })

Steps to Reproduce

  1. Configure Remix SDK as described in the setup guide (mine above has some small additions)
  2. Run eslint with recommended config

Expected Result

No eslint error

Actual Result

Some variation of #4569 and #6705:

  32:18  error  'BrowserTracing' not found in imported namespace 'Sentry'  import/namespace
  39:18  error  'Replay' not found in imported namespace 'Sentry'          import/namespace

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Reactions: 2
  • Comments: 22 (10 by maintainers)

Most upvoted comments

@binajmen thank you! A maintainer has answered there and clarified. With that information, I can say that we simply have an incompatibility with eslint-plugin-import that we will not fix (at least in the near future).

The SDK has different exports depending on which context it is run (server or client) and we currently do not have plans to align them. The TS type definitions are isomorphic and complete and our source of truth. If you want you can rely on those.

Closing as wont-fix (for now).

I think this is a bug in eslint-plugin-import that our SDK just happens to run into. Would you mind raising an issue there?

I don’t feel the need to fix this in the SDK because Typescript itself and other eslint plugins are able to resolve the exports just fine 🤔

sure, I understand, can’t figure out why it works like this, very strange behavior, I think it is something pnpm related. I will prepare demo, but can’t promise when (enough hard week). Hope this is my env related issue and will not affect anyone else

@mmospanenko can you try deleting your node modules, cleaning your pnpm chache, and reinstalling everything? Thanks.

Got the same issue with replayIntegration using pnpm, "@sentry/react": "^7.102.0" image