Nuxt
This page documents the Bugsee JavaScript SDK, which is in beta (0.1.x) and can change between betas.
@bugsee/nuxt is a Nuxt module that wires the browser client (with the Vue error handler) and the Nitro server from one entry in nuxt.config.ts. It is a single install: it bundles the browser, Node.js and Edge SDKs and the Vue adapter.
Requirements
- Nuxt 3 or newer.
nuxt,@nuxt/kit(3 or newer) andnitropack(2 or newer) are optional peer dependencies, normally already present in a Nuxt app. - Node.js 18 or newer for server code.
- An app token. Create a JavaScript application in Bugsee and choose Nuxt as its target; see Create your app.
Install
- npm
- pnpm
- yarn
- bun
npm install @bugsee/nuxt
pnpm add @bugsee/nuxt
yarn add @bugsee/nuxt
bun add @bugsee/nuxt
Set up
Register the module and pass your token in the bugsee block. There is nothing else to wire.
export default defineNuxtConfig({
modules: ['@bugsee/nuxt'],
bugsee: {
appToken: process.env.BUGSEE_TOKEN,
},
});
The module adds a client plugin that launches the browser SDK and installs the Vue error handler, and a Nitro server plugin that launches the server SDK and reports Nitro errors. On an edge Nitro preset (for example Cloudflare or Vercel Edge) it ships the edge SDK instead of the Node.js one.
The token is written to Nuxt's public runtime config so the browser can launch. An application token is not a secret.
Options
The bugsee block takes:
| Option | Type | Description |
|---|---|---|
appToken | string | Your Bugsee application token (required). |
client | object | Extra browser launch options, for example { replay: false } or { maxRecordingTime: 30 }. |
server | object | Extra Nitro (server) launch options, for example { captureLocalVariables: true }. |
export default defineNuxtConfig({
modules: ['@bugsee/nuxt'],
bugsee: {
appToken: process.env.BUGSEE_TOKEN,
client: { captureNetwork: true },
server: { instrumentIncomingRequests: true },
},
});
client takes the browser options. server takes the Node.js options. Values you set under runtimeConfig.public.bugsee or runtimeConfig.bugsee directly, or through environment overrides, win over the module defaults.
Entry points
| Entry | Description |
|---|---|
@bugsee/nuxt | The module, with ModuleOptions and setupBugseeModule. |
@bugsee/nuxt/client | installBugseeClient(nuxtApp, options), used by the generated client plugin. |
@bugsee/nuxt/server | installBugseeNitro and the shared client exports. |
@bugsee/nuxt/edge | The edge build for edge Nitro presets. |
You normally use only the module.
Notes
- The Vue error handler is installed for you. On a plain Vue app it is required in production; see Vue.
- Edge presets use the incident-driven edge SDK. See Vercel Edge.
- Source maps. The Nuxt build runs on Vite. See Bundler plugins.
- Backend context. Each Nitro request gets a context so logs and errors tie to it. See Backend.
Verify
Throw from a component or a server route:
export default defineEventHandler(() => {
throw new Error('Bugsee test error');
});
Request /api/test. The error shows up in the Bugsee dashboard.
Related pages
- Vue — the adapter this module installs
- Browser — client launch options
- Node.js — server launch options
- Bundler plugins — upload source maps from Vite