@blackwall/sentry-nuxt
v2.3.0
Published
Sentry module for Nuxt.js with nuxt-env support
Downloads
4
Readme
@bchteam/sentry-nuxt
Sentry module for Nuxt.js forked from @nuxtjs/sentry with fixes and nuxt-env support.
Features
The module enables error logging through Sentry.
nuxt-env is supported.
Setup
- Add
@bchteam/sentry-nuxt
dependency using yarn or npm to your project - Add
@bchteam/sentry-nuxt
tomodules
section ofnuxt.config.js
- Add options by
process.env
variables, insentry
section ofnuxt.config.js
or with module.
{
modules: [
['@bchteam/sentry-nuxt', {
dsn: 'https://[email protected]/12...34'
}]
],
sentry: {
disabled: true,
config: {
// Additional Sentry config
},
},
}
Nuxt compatibility
Only Nuxt versions > 1.2.1 are supported
Usage
Enter your DSN in the NuxtJS config file. Additional Sentry config settings can be found here.
Usage in Vue component
In a Vue component, Raven
is available as this.$sentry
, so we can call functions like
this.$sentry.captureException(new Error('error'))
Options
Options can be passed using either environment variables or sentry
section in nuxt.config.js
.
Normally setting required DSN information would be enough.
dsn
- Type:
String
- Default:
process.env.SENTRY_DSN || ''
- Default:
disabled
- Type:
Boolean
- Default:
process.env.SENTRY_DISABLED !== 'false'
- Default:
disableClientSide
- Type:
Boolean
- Default:
process.env.SENTRY_DISABLE_CLIENT_SIDE === 'true'
- Default:
useNuxtEnv
Use nuxt-env to get dsn
, disabled
and disableClientSide
options dynamically without rebuilding.
It cannot be changed after project is built.
It needs env vars SENTRY_DISABLED
, SENTRY_DSN
and SENTRY_DISABLE_CLIENT_SIDE
to be
included to node-env options. It's used inside the plugin nevertheless you use it in your config or not.
Place nuxt-env
in modules
section of nuxt.config.js
BEFORE this module!
- Type:
Boolean
- Default:
false
- Default:
securityToken
Security token for protecting source maps. If it is set, any request for any
source map (file that ends with .map
) without header
x-sentry-token: <securityToken>
will be forbidden.
Do not include it in nuxt-env
options! It must be unavailable for users for security reasons.
More info
- Type:
String
- Default:
process.env.SENTRY_SECURITY_TOKEN || ''
- Default:
License
Copyright (c) 2018 Zakharov Sergey [email protected]
Copyright (c) Diederik van den Burger [email protected]