View Source mix sentry.package_source_code (Sentry v11.0.4)
Packages source code for Sentry to use when reporting errors.
This task should be used in production settings, before building a release of your
application. It packages all the source code of your application in a single file
(called sentry.map), which is optimized for fast retrieval of source code lines.
Sentry then uses this to report source code context. See the documentation for the
Sentry module for configuration options related to the source code context.
This task is available since v10.0.0 of this library.
Usage
mix sentry.package_source_code
Using in Production
In production settings, call this task before building a release. This way, the source code packaged by this task will be included in the release.
For example, in a release script (this could also be in a Dockerfile, if you're using
Docker):
# ...
mix sentry.package_source_code
mix release
Runtime Configuration
If you use
config/runtime.exsfor runtime configuration of your application and release, and you also configure the source-context-related options for the:sentryapplication in that file (such as:root_source_code_paths), you'll need to call themix app.configtask before calling this Mix task.mix app.configloads theconfig/runtime.exsconfiguration. Generally, we recommend configuring all the source-context-related options in compile-time config files (likeconfig/config.exsorconfig/prod.exs).
Options
--debug- print more information about collecting and encoding source code--output PATH- write source map file to the givenPATH. If you don't specify this option, the file will be written to the default path, which is inside theprivdirectory of the:sentryapplication. If you use this option, remember to also configure the:source_code_map_pathoption, otherwise Sentry will try to read the file from the default location. SeeSentryfor more information. This option can be useful when the sourceprivdirectory is read-only, such as with NixOS and similar tools. Available since v10.2.0.--no-compile- does not compile applications before running--no-deps-check- does not check dependencies before running