AppSignal for JavaScript configuration
When initialising AppSignal in your application, you must pass an object with configuration options to the Appsignal
constructor:
The following configuration options are available:
key
- Type:
string
The front-end error monitoring API key for your application. You can find this API key under "Front-end error monitoring" in the "Push & Deploy" section of your application's settings.
This is not the same as the organization-level or application-level API key, which is used for monitoring in our back-end integrations.
namespace
- Type:
string
- Default value:
"frontend"
The default namespace to use to report errors to AppSignal. Read more in our namespaces guide.
revision
- Type:
string
Set the app revision for the currently running version of your app. This is used to create deploy markers and tag all incoming data as belonging to a specific deploy. Read more in our deploy markers guide.
ignoreErrors
- Type:
RegExp[]
An array of regular expressions to check against the message
property of any error reported to AppSignal. If any of the regular expressions matches, the error is ignored. Read more in our ignoring errors guide.
matchBacktracePaths
- Type:
RegExp[]
An array of regular expressions with one or more match groups. These regular expressions will be checked against the backtrace line paths of errors reported to AppSignal. If any of the regular expressions matches with one or more non-empty match groups, the path in the backtrace line is replaced with the result of concatenating the match groups.
This is useful when the path at which your application is deployed is not known ahead of time. For example, the path to an Electron application may be different on each user's machine. You can match for the part of that path that is known to represent your application.
For example, if your application's source code is located at a path like the following, where ${USERNAME}
changes for each user:
Then you can use this configuration option as follows:
When an error is reported, the backtrace line paths will be replaced with the result of the match group, which in this example will be bundle/app.js
.
This ensures that errors reported to AppSignal are grouped correctly when using backtrace line grouping, and allows for private sourcemaps to be uploaded for the cleaned path.