-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
eslint(import/namespace): error 'BrowserTracing' not found in imported namespace 'Sentry' #9728
Comments
Hi, how did you import |
As directed in the setup guide: import * as Sentry from "@sentry/remix"; |
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. |
Here you go: https://github.com/brettdh/sentry-remix-eslint-repro Steps I took:
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. |
My suspicion is that eslint is trying to resolve the Sentry import and picking the wrong entry point of the sentry-javascript/packages/remix/package.json Lines 15 to 18 in 970b522
We rely on these entry points so that the bundler picks up the correct client or server SDK. Not sure how to solve this though other than ignoring the rule for the Sentry import (which I totally get is not ideal). We briefly talked about shimming server and client-only exports in the respective opposite bundles (#9594) but it'd come with a cost possible bundle size increases and having to maintain these shims. |
@mmospanenko can you try deleting your node modules, cleaning your pnpm chache, and reinstalling everything? Thanks. |
yes, I was playing with it, but let me do it again. I use pnpm monorepo and Sentry only in one package (It could this behavior... maybe we should install all deps explicitly, etc)
I import it as and have only Sentry (other ton of packages ok) errors in ESLint after migration from Yarn to pnpm:
ESLint rules are 'recommended' default mostly, |
@lforst I'm facing the same issue. I don't mind give you access to my private repo if that is okay for you? |
@binajmen For sure, although a minimal reproduction would be more ideal, just to isolate the actual issue. |
@lforst I've just added you to the project. Unfortunately, I won't be able to create a reproducible example until next week. In the meantime, feel free to clone the repository if you have some time to spare. Currently, the project is not too extensive, so you shouldn't encounter much interference. :) |
@binajmen Thank you! A public reproduction would be awesome so that other people can pick this up too! I will try to take a look. |
I think this is a bug in 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 🤔 |
I have opened an issue on the Would the best workaround be to temporarily ignore these ESLint errors? |
@binajmen thank you! A maintainer has answered there and clarified. With that information, I can say that we simply have an incompatibility with 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). |
@lforst thank you, not sure how I'll fix the lint issue but at least we know ;) |
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. |
same error. @lforst Minimum Reproducible Repository: https://github.com/GOWxx/remix-pnpm-sentry-eslint-namespace-error-repo |
@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 |
* feat: @sentry/react를 설치한다 * feat: sentry sourcemap을 추가한다 * feat: ErrorBoundary에 sentry 에러 추적을 추가한다 * feat: initSentry와 testSentry를 모듈화한다 * feat: NewTab, Options, SidePanel에서 Sentry를 설정한다 * feat: release에 현재 package.json기준 버전을 추가한다 * feat: @sentry/vite-plugin를 전역에 설치한다 * fix: 브라우저에서는 fs모듈을 사용하지 못하기에 제거한다 * fix: release값을 string으로 정의한다 * feat: eslint-plugin-import와 Sentry의 호환 이슈로, ESlint 무효화 주석을 추가한다 ref : getsentry/sentry-javascript#9728 * feat: options와 new-tab에도 vite config에 sentry설정을 추가한다 * feat: build CI 과정에서 .env에 vite auth token을 삽입한다 * feat: eslint-plugin-import와 Sentry의 호환 이슈로, ESlint 무효화 주석을 추가한다 ref : getsentry/sentry-javascript#9728 * feat: dsn값을 환경변수로 주입한다 * refactor: tsconfig.json의 module을 base.json에서 일괄 관리한다 * feat: build과정에서 환경변수를 주입한다 * feat: sentry 테스트 코드를 제거한다 * fix: options의 type:module을 제거한다 * feat: sentry 관련 환경 변수를 vite-env.d.ts와 turbo.json에 추가한다 * feat: 배포된 환경인지 체크하는 isProduciton 유틸함수를 구현한다 ref : https://developer.chrome.com/docs/extensions/reference/api/management#type-ExtensionInstallType * refactor: 함수이기에 `getIsProduction`으로 네이밍을 수정한다 * feat: 환경에 따라 tracesSampleRate값을 다르게 설정한다 ref : https://docs.sentry.io/platforms/javascript/tracing/
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
Steps to Reproduce
Expected Result
No eslint error
Actual Result
Some variation of #4569 and #6705:
The text was updated successfully, but these errors were encountered: