Nuxt

Server-Side Monitoring for Nuxt and Nitro

Free on every plan, including the free one
Where to get it npm
Requirements Nuxt 3 and Nitro, Node.js runtime
Package name @dockcodes/dock-ray-nuxt
Pricing Free

What it is for

The official DockRay module for Nuxt integrates Nuxt 3 and 4 applications with the DockRay monitoring platform. It automatically reports server-side errors, monitors request processing times, and can optionally collect Vue and JavaScript errors from the browser.

Server-Side Error Monitoring

DockRay integrates with Nitro and reports unhandled server errors along with information about the matched route.

Reported events can include:

  • the error type and message,
  • where the error occurred and the stack trace,
  • environment and application version information,
  • context related to the request being processed.

By default, 5xx responses are reported as application errors. Expected 4xx errors, such as 404 responses, are not treated as application failures.

Performance Monitoring

The module measures request processing times and reports transactions after the response has been sent to the user. Transactions are grouped by route pattern, so different IDs do not create separate entries in the dashboard.

The frequency of data collection can be controlled using a sampling rate.

Vue and JavaScript Error Monitoring

You can optionally enable browser-side error collection. The integration supports both standard JavaScript errors and Vue component errors captured through Nuxt hooks.

Browser events are first sent to your own Nuxt application and then forwarded to DockRay, ensuring that your project's private key remains exclusively on the server.

Nitro, Node, and Edge

The integration works through Nitro and supports both Node.js environments and worker-based deployments, including environments compatible with the Fetch API.

Privacy and Security

Sensitive headers such as Authorization, Cookie, Set-Cookie, and X-Api-Key are removed from reported data.

Sending the IP address and user agent is optional and can be controlled in the module configuration.

Installation

Module Installation

Install DockRay using npm:

bash
npm install @dockcodes/dock-ray-nuxt

Configuration

Add the module to your nuxt.config.ts file:

js
export default defineNuxtConfig({
    modules: ['@dockcodes/dock-ray-nuxt'],

    ray: {
        tracesSampleRate: 0.2,
        browser: {
            enabled: false
        }
    }
});

Then add your DockRay project credentials to your environment variables:

NUXT_RAY_TOKEN=project-token
NUXT_RAY_PRIVATE_KEY=project-private-key

You can find your project token and private key in the DockRay dashboard.

Credentials are stored in Nuxt's private runtime configuration and should not be placed in runtimeConfig.public, as the contents of this section are exposed to client-side code.

Without a configured token and private key, the module remains inactive and does not send any data.

Optional JavaScript Error Monitoring

To enable Vue and JavaScript error monitoring in the browser, set:

ray: {
    browser: {
        enabled: true
    }
}

How to use it

The integration reports exceptions on its own. This is for the reports you send deliberately.

js
export default defineNuxtConfig({
    modules: ['@dockcodes/dock-ray-nuxt'],

    ray: {
        tracesSampleRate: 0.2,
        browser: {
            enabled: true
        }
    }
});

Knowledge base articles

Start Monitoring

Connect your first application and get full visibility into what’s happening in production.

DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.