-
Notifications
You must be signed in to change notification settings - Fork 51
fix(plugin-manager): Respect sourcemap.ignore values for injecting debugIDs
#836
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ import { | |
| arrayify, | ||
| getProjects, | ||
| getTurborepoEnvPassthroughWarning, | ||
| serializeIgnoreOptions, | ||
| stripQueryAndHashFromPath, | ||
| } from "./utils"; | ||
| import { glob } from "glob"; | ||
|
|
@@ -554,7 +555,12 @@ export function createSentryBuildPluginManager( | |
| try { | ||
| const cliInstance = createCliInstance(options); | ||
| await cliInstance.execute( | ||
| ["sourcemaps", "inject", ...buildArtifactPaths], | ||
| [ | ||
| "sourcemaps", | ||
| "inject", | ||
| ...serializeIgnoreOptions(options.sourcemaps?.ignore), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The Suggested FixEnsure the Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
| ...buildArtifactPaths, | ||
| ], | ||
sentry[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| options.debug ? "rejectOnError" : false | ||
| ); | ||
| } catch (e) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -408,3 +408,23 @@ export function getProjects(project: string | string[] | undefined): string[] | | |||||||
|
|
||||||||
| return undefined; | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Inlined functionality from @sentry/cli helper code to add `--ignore` options. | ||||||||
| * | ||||||||
| * Temporary workaround until we expose a function for injecting debug IDs. Currently, we directly call `execute` with CLI args to inject them. | ||||||||
| */ | ||||||||
| export function serializeIgnoreOptions(ignoreValue: string | string[] | undefined): string[] { | ||||||||
| const DEFAULT_IGNORE = ["node_modules"]; | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm I wonder if including node_modules has any implications but I don't think so: We inject debug ids into emitted bundles, meaning the node_modules required by the bundle should already be in there. Also, the ignore option for upload also defaults to
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not ignoring it can result in file import loops (this is what happens in e.g. Nuxt). And yes, it's also the default option for uploading source maps. |
||||||||
|
|
||||||||
| const ignoreOptions: string[] = Array.isArray(ignoreValue) | ||||||||
| ? ignoreValue | ||||||||
| : typeof ignoreValue === "string" | ||||||||
| ? [ignoreValue] | ||||||||
| : DEFAULT_IGNORE; | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wondering if we don't always want to add this ignore? In the sense that a user should likely never inject debug ids in node_modules but they usually want to additionally ignore other paths etc. no?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call! I just resembled the existing logic from the CLI here (user-provided value overwrites): https://github.com/getsentry/sentry-cli/blob/a618fb33ddfc3646ac8d5e2391ea1ee6e208b709/lib/releases/index.ts#L159-L161 Either we document, that @Lms24 any opinions on that?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So according to this doc, the default is
Me too, because the alternative would be a behaviour break, right? So let's avoid that 😅
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the JS bundler plugins, this is correct. But this value is passed down a bunch of times:
Maybe it's worth applying this default in the bundler plugins already, as we could align the behavior better on this stage. Only the Plugin Manger uses the CLI under the hood, and there are no defaults otherwise.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Talked offline, created an issue: #838 |
||||||||
|
|
||||||||
| return ignoreOptions.reduce( | ||||||||
| (acc, value) => acc.concat(["--ignore", String(value)]), | ||||||||
| [] as string[] | ||||||||
| ); | ||||||||
| } | ||||||||
|
Comment on lines
+417
to
+430
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a simplified version of: https://github.com/getsentry/sentry-cli/blob/9f34df859bf2975155aad0fe5c6c423b45c07084/lib/helper.ts#L199-L217 |
||||||||
Uh oh!
There was an error while loading. Please reload this page.