Open jbg opened 9 months ago
Hi @jbg, thank you for reporting, and thank you for opening #1917. I will try to get #1917 reviewed as soon as I have some time.
I agree with you that it would make more sense to only skip injecting debug IDs into invalid sourcemaps, instead of skipping all remaining sourcemaps when a single erroneous sourcemap is found. However, our team is quite busy with other projects at the moment, so it might take us some time to implement this enhancement.
I am placing this issue on our backlog. In the meantime, you can likely workaround this issue by using the --ignore
or --ignore-file
command line arguments to manually skip injecting debug IDs into the invalid sourcemap files. You are also welcome to open a PR with a suggested fix!
I'm curious if there's documentation on using --ignore or --ignore-file.
error: Invalid sourcemap at ./node_modules/regexpp/index.js.map caused by: bad json: invalid type: map, expected a string at line 1 column 327
I have a similar issue and I'd like to ignore the node_modules that cause errors.
@flightknight22 Adding --help
to any command will list the available command line options and describe what they do. For example:
$ sentry-cli sourcemaps inject --help
Fixes up JavaScript source files and sourcemaps with debug ids.
For every minified JS source file, a debug id is generated and inserted into the
file. If the source file references a sourcemap and that sourcemap is locally
available, the debug id will be injected into it as well. If the referenced
sourcemap already contains a debug id, that id is used instead.
Usage: sentry-cli sourcemaps inject [OPTIONS] <PATHS>...
Arguments:
<PATHS>...
A path to recursively search for javascript files that should be
processed.
Options:
-i, --ignore <IGNORE>
Ignores all files and folders matching the given glob
-o, --org <ORG>
The organization slug
--header <KEY:VALUE>
Custom headers that should be attached to all requests
in key:value format.
-I, --ignore-file <IGNORE_FILE>
Ignore all files and folders specified in the given ignore file, e.g.
.gitignore.
-p, --project <PROJECT>
The project slug.
--auth-token <AUTH_TOKEN>
Use the given Sentry auth token.
-r, --release <RELEASE>
The release slug.
-x, --ext <EXT>
Set the file extensions of JavaScript files that are considered for
injection. This overrides the default extensions (js, cjs, mjs). To
add an extension, all default extensions must be repeated. Specify
once per extension. Source maps are discovered via those files.
--dry-run
Don't modify files on disk.
--log-level <LOG_LEVEL>
Set the log output verbosity.
[possible values: trace, debug, info, warn, error]
--quiet
Do not print any output while preserving correct exit code. This flag
is currently implemented only for selected subcommands.
[aliases: silent]
-h, --help
Print help (see a summary with '-h')
Hope that helps, please let me know if you need any more information!
Environment
macOS 14.3, sentry-cli 2.26.0
Steps to Reproduce
"version": 3.0
(note the floating point version number) to your project, or add a dependency onxml2js
0.6.2 which contains such an erroneous source map.sentry-cli sourcemaps inject
Expected Result
Debug IDs would be injected in all valid source maps, and perhaps a warning would be printed about source maps with errors.
Actual Result
sentry-cli
exited with an error as soon as it encountered the erroneous source map.Logs
Note that the error reporting also has a bug, printing a literal
{source_url}
instead of the actual URL, that's fixed in #1917