Sentry module for Nuxt.js
The module enables error logging through Sentry.
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: {
public_key: '',
project_id: '',
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
- Default:
- Type:
String
- Default:
process.env.SENTRY_PUBLIC_KEY
- Default:
Will be ignored if dsn
provided.
- Type:
String
- Default:
process.env.SENTRY_HOST || 'sentry.io'
- Default:
Will be ignored if dsn
provided.
- Type:
String
- Default:
process.env.SENTRY_PROTOCOL || 'https'
- Default:
Will be ignored if dsn
provided.
- Type:
String
- Default:
process.env.SENTRY_PROJECT_ID || ''
- Default:
Will be ignored if dsn
provided.
- Type:
String
- Default:
process.env.SENTRY_PATH || '/'
- Default:
Will be ignored if dsn
provided.
- Type:
Boolean
- Default:
process.env.SENTRY_DISABLED || false
- Default:
- Type:
Boolean
- Default:
process.env.SENTRY_DISABLE_CLIENT_SIDE || false
- Default:
Copyright (c) Diederik van den Burger [email protected]