44 </a >
55</p >
66
7- # Official Sentry SDK for Nuxt (EXPERIMENTAL )
7+ # Official Sentry SDK for Nuxt (BETA )
88
99[ ![ npm version] ( https://img.shields.io/npm/v/@sentry/nuxt.svg )] ( https://www.npmjs.com/package/@sentry/nuxt )
1010[ ![ npm dm] ( https://img.shields.io/npm/dm/@sentry/nuxt.svg )] ( https://www.npmjs.com/package/@sentry/nuxt )
1111[ ![ npm dt] ( https://img.shields.io/npm/dt/@sentry/nuxt.svg )] ( https://www.npmjs.com/package/@sentry/nuxt )
1212
13- ** This SDK is under active development! Feel free to already try it but expect breaking changes**
13+ This SDK is in ** Beta** . The API is stable but updates may include minor changes in behavior. Please reach out on
14+ [ GitHub] ( https://github.com/getsentry/sentry-javascript/issues/new/choose ) if you have any feedback or concerns. This
15+ SDK is for [ Nuxt] ( https://nuxt.com/ ) . If you're using [ Vue] ( https://vuejs.org/ ) see our
16+ [ Vue SDK here] ( https://github.com/getsentry/sentry-javascript/tree/develop/packages/vue ) .
1417
1518## Links
1619
17- todo: link official SDK docs
18-
19- - [ Official Browser SDK Docs] ( https://docs.sentry.io/platforms/javascript/ )
20- - [ Official Node SDK Docs] ( https://docs.sentry.io/platforms/node/ )
20+ - [ Official Nuxt SDK Docs] ( https://docs.sentry.io/platforms/javascript/guides/nuxt/ )
2121
2222## Compatibility
2323
@@ -28,43 +28,12 @@ The minimum supported version of Nuxt is `3.0.0`.
2828This package is a wrapper around ` @sentry/node ` for the server and ` @sentry/vue ` for the client side, with added
2929functionality related to Nuxt.
3030
31- ** What is working:**
32-
33- - Error Reporting
34- - Vue
35- - Node
36- - Nitro
37-
38- ** What is partly working:**
39-
40- - Source Maps
41- - Connected Tracing (Frontend & Backend)
42- - Tracing by setting ` tracesSampleRate `
43- - UI (Vue) traces
44- - HTTP (Node) traces
45-
46- ** Known Issues:**
47-
48- - When adding ` sentry.server.config.(ts/js) ` , you get an error like this:
49- "` Failed to register ESM hook (import-in-the-middle/hook.mjs) ` ". You can add a resolution for ` @vercel/nft ` to fix
50- this. This will add the ` hook.mjs ` file to your build output
51- ([ issue here] ( https://github.com/unjs/nitro/issues/2703 ) ).
52- ``` json
53- "resolutions" : {
54- "@vercel/nft" : " ^0.27.4"
55- }
56- ```
57-
58- ## Automatic Setup
31+ ** Limitations:**
5932
60- todo: add wizard instructions
61-
62- Take a look at the sections below if you want to customize your SDK configuration.
33+ - Server monitoring is not available during development mode (` nuxt dev ` )
6334
6435## Manual Setup
6536
66- If the setup through the wizard doesn't work for you, you can also set up the SDK manually.
67-
6837### 1. Prerequisites & Installation
6938
70391 . Install the Sentry Nuxt SDK:
@@ -92,7 +61,7 @@ export default defineNuxtConfig({
9261
9362### 3. Client-side setup
9463
95- Add a ` sentry.client.config.(js|ts) ` file to the root of your project:
64+ Add a ` sentry.client.config.ts ` file to the root of your project:
9665
9766``` javascript
9867import { useRuntimeConfig } from ' #imports' ;
@@ -106,7 +75,7 @@ Sentry.init({
10675
10776### 4. Server-side setup
10877
109- Add an ` sentry.client.config.(js|ts) ` file to the root of your project:
78+ Add an ` sentry.client.config.ts ` file to the root of your project:
11079
11180``` javascript
11281import * as Sentry from ' @sentry/nuxt' ;
@@ -119,11 +88,12 @@ if (process.env.SENTRY_DSN) {
11988}
12089```
12190
122- The Nuxt runtime config does not work in the Sentry server to technical reasons (it has to be loaded before Nuxt is
123- loaded). To be able to use ` process.env ` you either have to add ` --env-file=.env ` to your node command
91+ Using ` useRuntimeConfig ` does not work in the Sentry server config file due to technical reasons (the file has to be
92+ loaded before Nuxt is loaded). To be able to use ` process.env ` you either have to add ` --env-file=.env ` to your node
93+ command
12494
12595``` bash
126- node --env-file=.env --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs
96+ node --env-file=.env .output/server/index.mjs
12797```
12898
12999or use the ` dotenv ` package:
@@ -139,28 +109,18 @@ Sentry.init({
139109});
140110```
141111
142- Add an import flag to the Node options of your ` node ` command (not ` nuxt preview ` ), so the file loads before any other
143- imports (keep in mind the ` .mjs ` file ending):
144-
145- ``` json
146- {
147- "scripts" : {
148- "start" : " node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs"
149- }
150- }
151- ```
152-
153112## Uploading Source Maps
154113
155- To upload source maps, you can use the ` sourceMapsUploadOptions ` option inside the ` sentry ` options of your
156- ` nuxt.config.ts ` :
114+ To upload source maps, you have to enable client source maps in your ` nuxt.config.ts ` . Then, you add your project
115+ settings to the ` sentry.sourceMapsUploadOptions ` of your ` nuxt.config.ts ` :
157116
158117``` javascript
159118// nuxt.config.ts
160119export default defineNuxtConfig ({
120+ sourcemap: { client: true },
121+
161122 modules: [' @sentry/nuxt/module' ],
162123 sentry: {
163- debug: true ,
164124 sourceMapsUploadOptions: {
165125 org: ' your-org-slug' ,
166126 project: ' your-project-slug' ,
@@ -169,3 +129,24 @@ export default defineNuxtConfig({
169129 },
170130});
171131```
132+
133+ ## Troubleshooting
134+
135+ When adding ` sentry.server.config.ts ` , you might get an error like this:
136+ "` Failed to register ESM hook import-in-the-middle/hook.mjs ` ". You can add an override (npm/pnpm) or a resolution (yarn)
137+ for ` @vercel/nft ` to fix this. This will add the ` hook.mjs ` file to your build output
138+ ([ Nitro issue here] ( https://github.com/unjs/nitro/issues/2703 ) ).
139+
140+ ``` json
141+ "overrides" : {
142+ "@vercel/nft" : " ^0.27.4"
143+ }
144+ ```
145+
146+ or in ` yarn ` :
147+
148+ ``` json
149+ "resolutions" : {
150+ "@vercel/nft" : " ^0.27.4"
151+ }
152+ ```
0 commit comments