User Feedback

When a user experiences an error, Sentry provides the ability to collect additional feedback through a feedback dialog.

Setup

showReportDialog is a function that should be called to trigger the User Feedback dialog. Due to how Nuxt works, we can't reference it directly from within Nuxt config as Sentry configuration is strinigified and the function reference does not survive that. We have to use the clientConfig option with a path to a custom client configuration that imports the function like so:

nuxt.config.js
sentry: {
  dsn: '...',
  clientConfig: '~/config/sentry-client-config.js',
}
~/config/sentry-client-config.js
import { showReportDialog } from '@sentry/vue'

export default function(context) {
  return {
    beforeSend (event, hint) {
      if (event.exception) {
        showReportDialog({ eventId: event.event_id })
      }
      return event
    },
  }
}

The configuration provided through clientConfig is merged with the configuration provided in the Nuxt config so other configuration options can (but don't have to) be defined in Nuxt config.

Documentation

See Sentry's User Feedback pages for additional information.

Edit this page on GitHub Updated at Mon, Nov 27, 2023