Skip to content

eslint(import/namespace): error 'BrowserTracing' not found in imported namespace 'Sentry' #9728

Closed as not planned

Description

@brettdh

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

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀on Dec 4, 2023
  2. lforst commented on Dec 4, 2023

    @lforst
    Contributor

    Hi, how did you import Sentry?

  3. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀on Dec 4, 2023
  4. brettdh commented on Dec 4, 2023

    @brettdh
    Author

    As directed in the setup guide:

    import * as Sentry from "@sentry/remix";
  5. moved this to Waiting for: Product Owner in GitHub Issues with 👀on Dec 4, 2023
  6. lforst commented on Dec 4, 2023

    @lforst
    Contributor

    Would you mind sharing a small reproduction repo where we can generate this bug? Thanks!

    Our generated types look fine so I am surprised you're running into this.

  7. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀on Dec 4, 2023
  8. brettdh commented on Dec 6, 2023

    @brettdh
    Author

    Here you go: https://github.com/brettdh/sentry-remix-eslint-repro

    Steps I took:

    1. Run npx create-remix@latest --template remix-run/grunge-stack . (brettdh/sentry-remix-eslint-repro@50a7dbb)
    2. Tidy up a couple things and commit the results of the remix.init script (brettdh/sentry-remix-eslint-repro@dfacdee)
    3. Run npx @sentry/wizard@latest -i remix and fix unrelated import/order errors (brettdh/sentry-remix-eslint-repro@9635d84)

    TIL that Github Actions has inline code annotations for checks like eslint 😮 as the errors I mentioned in the initial post also appear in that last commit I linked.

  9. 42 remaining items

  10. lforst commented on Feb 23, 2024

    @lforst
    Contributor

    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 🤔

  11. binajmen commented on Feb 27, 2024

    @binajmen

    I have opened an issue on the eslint-plugin-import repository. Please feel free to add to it, as I was unable to provide detailed information.

    Would the best workaround be to temporarily ignore these ESLint errors?

  12. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Feb 27, 2024
  13. lforst commented on Feb 27, 2024

    @lforst
    Contributor

    @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).

  14. binajmen commented on Feb 27, 2024

    @binajmen

    @lforst thank you, not sure how I'll fix the lint issue but at least we know ;)

  15. ljharb commented on Feb 27, 2024

    @ljharb

    fwiw, that's a very confusing API, and strongly suggests it should be split into two packages if it's not going to be aligned.

  16. GOWxx commented on May 12, 2024

    @GOWxx

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

    same error.

    @lforst
    I created a repository, hoping this can help you. Thank you for your hard work and dedication!

    Minimum Reproducible Repository:

    https://github.com/GOWxx/remix-pnpm-sentry-eslint-namespace-error-repo

    remix-vite-sentry-namespace-error
  17. lforst commented on May 14, 2024

    @lforst
    Contributor

    @GOWxx we will not fix this. Please see import-js/eslint-plugin-import#2969 (comment)

  18. GOWxx commented on May 16, 2024

    @GOWxx

    @GOWxx we will not fix this. Please see import-js/eslint-plugin-import#2969 (comment)

    Thank you for your reply. I will look for information related to TS import resolver to try and solve the issue. Thank you!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions