@blackwall/sentry-nuxt

2.3.0 • Public • Published

@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 to modules section of nuxt.config.js
  • Add options by process.env variables, in sentry section of nuxt.config.js or with module.
{
  modules: [
    ['@bchteam/sentry-nuxt', {
        dsn: 'https://03b1da01f630449cb263f595de7.....@sentry.io/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 || ''

disabled

  • Type: Boolean
    • Default: process.env.SENTRY_DISABLED !== 'false'

disableClientSide

  • Type: Boolean
    • Default: process.env.SENTRY_DISABLE_CLIENT_SIDE === 'true'

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

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 || ''

License

MIT License

Copyright (c) 2018 Zakharov Sergey zakhse@yandex.ru

Copyright (c) Diederik van den Burger diederik@webrelated.nl

Dependents (0)

Package Sidebar

Install

npm i @blackwall/sentry-nuxt

Weekly Downloads

1

Version

2.3.0

License

MIT

Unpacked Size

9.76 kB

Total Files

6

Last publish

Collaborators

  • zakhse
  • diqost23