Search code examples
circlecisentry

Sentry --rewrite option failing command


I am looking at improving a CI process by rewriting source maps, and found I can not add the --rewrite option in anywhere.

The command I am adding it to is:

sentry-cli --auth-token $SENTRY_TOKEN releases -o "my-org" files $LONG_COMMIT upload my_repo/my_files '~/my_public_folder'

No matter where I place it I always get the error:

error: Found argument '--rewrite' which wasn't expected, or isn't valid in this context USAGE: sentry-cli releases files upload [OPTIONS] [--] [NAME]

For example I have tried:

sentry-cli --auth-token $SENTRY_TOKEN releases -o "my-org" files $LONG_COMMIT upload my_repo/my_files '~/my_public_folder' --rewrite

sentry-cli --auth-token $SENTRY_TOKEN releases -o "my-org" files $LONG_COMMIT upload my_repo/my_files --rewrite '~/my_public_folder'

sentry-cli --auth-token $SENTRY_TOKEN releases -o "my-org" files $LONG_COMMIT upload --rewrite my_repo/my_files '~/my_public_folder'


Solution

  • The --rewrite option is not available for sentry-cli releases files upload. I believe that you're looking for the sentry-cli releases files upload-sourcemaps command, instead.

    Note that as of sentry-cli 1.59.0 the --rewrite option has been removed and enabled by default. You can opt out of rewriting using the --no-rewrite option:

     $ sentry-cli releases files upload-sourcemaps --help
    Upload sourcemaps for a release.
    
    USAGE:
        sentry-cli releases files <VERSION> upload-sourcemaps [OPTIONS] <PATHS>...
    
    OPTIONS:
    ...
            --no-rewrite
                Disables rewriting of matching sourcemaps. By default the tool will rewrite sources, so
                that indexed maps are flattened and missing sources are inlined if possible.
                This fundamentally changes the upload process to be based on sourcemaps and minified
                files exclusively and comes in handy for setups like react-native that generate
                sourcemaps that would otherwise not work for sentry.