Sentry module for Nuxt.js
The module enables error logging through Sentry.
- Please note that version 2.2.0 of this package removed the older
public_key
andprivate_key
options, since the updated Sentry packages don't support these anymore. - Please note that version 2.0.0 of this package introduces a breaking change. See #30 for more information.
- Add
@nuxtjs/sentry
dependency using yarn or npm to your project - Add
@nuxtjs/sentry
tomodules
section ofnuxt.config.js
{
modules: [
'@nuxtjs/sentry',
],
sentry: {
dsn: '', // Enter your project's DSN here
config: {}, // Additional config
}
}
Versions of NuxtJS between v1.0.0 and v1.2.1 are not supported by this package.
Enter your DSN in the NuxtJS config file. Additional config settings can be found here.
In a Vue component, Sentry
is available as this.$sentry
, so we can call functions like
this.$sentry.captureException(new Error('example'))
where this
is a Vue instance.
Options can be passed using either environment variables or sentry
section in nuxt.config.js
.
Normally setting required DSN information would be enough.
- Type:
String
- Default:
process.env.SENTRY_DSN
- If no
dsn
is provided, Sentry will be initialised, but errors will not be logged. See #47 for more information about this.
- Default:
- Type:
Boolean
- Default:
process.env.SENTRY_DISABLED || false
- Sentry will not be initialised if set to
true
.
- Default:
- Type:
Boolean
- Default:
process.env.SENTRY_DISABLE_CLIENT_SIDE || false
- Default:
- Type:
Object
- Default:
{}
- Default:
Recently, support for the sentry-webpack-plugin was introduced. This can be used to send releases to Sentry. Check out the feature/sourcemaps branch. After some more testing, this feature will be merged in to the master branch.
Copyright (c) Diederik van den Burger [email protected]