Skip to content

invalid definition in sourcemaps search #1975

Closed

Description

@doc-sheet

Environment

2.30.0 from docker

Steps to Reproduce

sentry-cli sourcemaps inject --ext=js.map /tmp

Expected Result

Same as --ext=map

Actual Result

Even after #605 fix TypesBuilder can't handle complex extensions like js.gz in sourcemaps inject/upload commands

Logs

  DEBUG   2024-03-11 12:30:35.784209567 +00:00 sentry-cli version: 2.30.0, platform: "linux", architecture: "x86_64"
  INFO    2024-03-11 12:30:35.784374170 +00:00 sentry-cli was invoked with the following command line: "/bin/sentry-cli" "--log-level=debug" "sourcemaps" "inject" "--ext=js.map" "/tmp"
> Searching /tmp
error: invalid definition (format is type:glob, e.g., html:*.html)

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Mar 11, 2024
  2. szokeasaurusrex commented on Mar 11, 2024

    @szokeasaurusrex
    Member

    @doc-sheet It appears that you are misusing the --ext argument in the "Steps to Reproduce" here. The --ext argument specifies the file extensions of JavaScript source files that you would like to have injected. By default, we include .js, .cjs, and .mjs; setting the --ext overrides this default. However, regardless of whether you pass --ext and regardless of what you set --ext to, we always inject Debug IDs into .map files if we find a corresponding source file.

    In fact, I believe the expected behavior of running the "Steps to Reproduce" command that you have provided would be for no Debug IDs to be injected anywhere. We only inject debug IDs into the sourcemaps after first finding the corresponding source file, which we will not find because you specified that we should only look for JS source files with the .js.map extension, which is not a valid extension for JS source files.

    So, in your case, I would recommend re-evaluating what you are trying to do with the command, because even with a bug fix, you will not achieve your expected result. I would be happy to point you in the right direction, if you explain what you are trying to achieve here by passing --ext=.js.map.


    That being said, although --ext should not be used in the way you are attempting to use it here, this is in fact a bug. Thank you for reporting it!

    Since the fix was relatively simple, I have already made a PR to solve the problem and enable complex extensions.

  3. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Mar 11, 2024
  4. doc-sheet commented on Mar 11, 2024

    @doc-sheet
    Author

    Hi!
    My actual problem was with sentry-cli sourcemaps upload --ext=js --ext=map --ext=js.gz --ext=map.gz ...
    But since inject and upload use the same search engine and inject is way easier to reproduce in networkless container I used it as an example.

    Sorry for confusing js.map - it just came in mind first.

    Now I'm trying workaround like --ext=js --ext=map --ext=gz (I guess in my case it's enough), but that error kinda surprised me so I decided to report it.

    Thank you for fix!

  5. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Mar 11, 2024
  6. szokeasaurusrex commented on Mar 12, 2024

    @szokeasaurusrex
    Member

    You are welcome, @doc-sheet. Specifying --ext=map is always unnecessary with sourcemaps inject, but for sourcemaps upload you indeed need to add it.

    But, thank you for letting me know that your original problem was with sourcemaps upload; I will make sure that my fix works with sourcemaps upload as well.

  7. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Mar 12, 2024
  8. added a commit that references this issue on Mar 12, 2024
    9a6f91b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions