Runtime config

This module is for Nuxt 2. For Nuxt 3+ support see the official @sentry/nuxt module.

Defining options using the Nuxt Runtime Config functionality allows them to be runtime-based rather than build-time based, as is the case by default.

Currently, only the config, clientConfig and serverConfig options can be configured using the runtime config.

In the Nuxt configuration file define a publicRuntimeConfig.sentry configuration object with settings that will be applied at runtime. For example:

nuxt.config.js
publicRuntimeConfig: {
  sentry: {
    config: {
      environment: process.env.SENTRY_ENVIRONMENT
    },
    serverConfig: {
      // Any server-specific config
    },
    clientConfig: {
      // Any client-specific config
    }
  }
}

You can customize the key that is used to access settings from publicRuntimeConfig by setting runtimeConfigKey in the non-runtime options.

This functionality is supported from Nuxt 2.13 and up.

Edit this page on GitHub Updated at Mon, Oct 7, 2024