Skip to content

Commit cd10012

Browse files
docs(js): Create Nuxt Quick Start guide for wizard installation (#13286)
* create Nuxt Quick Start guide for wizard setup; create and use new platform-includes * Apply suggestions from code review Co-authored-by: Sigrid Huemer <[email protected]> --------- Co-authored-by: Sigrid Huemer <[email protected]>
1 parent 4ac8fdb commit cd10012

File tree

10 files changed

+99
-166
lines changed

10 files changed

+99
-166
lines changed

docs/platforms/javascript/guides/nextjs/index.mdx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,7 @@ npx @sentry/wizard@latest -i nextjs
2121

2222
The wizard then guides you through the setup process, asking you to enable additional (optional) Sentry features for your application beyond error monitoring.
2323

24-
<Expandable title="Want to learn more about these features?">
25-
26-
- [**Issues**](/product/issues) (always enabled): Sentry's core error monitoring product that automatically reports errors,
27-
uncaught exceptions, and unhandled rejections. If you have something that
28-
looks like an exception, Sentry can capture it.
29-
- [**Tracing**](/product/tracing): Track software performance while seeing the
30-
impact of errors across multiple systems. For example, distributed tracing
31-
allows you to follow a request from the frontend to the backend and back.
32-
- [**Session Replay**](/product/explore/session-replay/web):
33-
Get to the root cause of an issue faster by viewing a video-like reproduction
34-
of what was happening in the user's browser before, during, and after the
35-
problem.
36-
37-
</Expandable>
24+
<PlatformContent includePath="getting-started-features-expandable" />
3825

3926
This guide assumes that you enable all features and allow the wizard to create an example page and route. You can add or remove features at any time, but setting them up now will save you the effort of configuring them manually later.
4027

docs/platforms/javascript/guides/nextjs/manual-setup.mdx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,7 @@ Choose the features you want to configure, and this guide will show you how:
1919
options={["error-monitoring", "performance", "session-replay"]}
2020
/>
2121

22-
<Expandable title="Want to learn more about these features?">
23-
24-
- [**Issues**](/product/issues) (always enabled): Sentry's core error monitoring product that automatically reports errors,
25-
uncaught exceptions, and unhandled rejections. If you have something that
26-
looks like an exception, Sentry can capture it.
27-
- [**Tracing**](/product/tracing): Track software performance while seeing the
28-
impact of errors across multiple systems. For example, distributed tracing
29-
allows you to follow a request from the frontend to the backend and back.
30-
- [**Session Replay**](/product/explore/session-replay/web):
31-
Get to the root cause of an issue faster by viewing a video-like reproduction
32-
of what was happening in the user's browser before, during, and after the
33-
problem.
34-
35-
</Expandable>
22+
<PlatformContent includePath="getting-started-features-expandable" />
3623

3724
### Install the Sentry SDK
3825

Lines changed: 54 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Nuxt
3-
description: Nuxt is a framework for full-stack web apps and websites. Learn how to set it up with Sentry.
3+
description: Learn how to set up and configure Sentry in your Nuxt application using the installation wizard, capture your first errors, and view them in Sentry.
44
sdk: sentry.javascript.nuxt
55
categories:
66
- javascript
@@ -9,128 +9,90 @@ categories:
99
---
1010

1111
<Alert level="warning">
12-
This SDK is currently in **beta**. Beta features are still in progress and may have bugs. Please reach out on
13-
[GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have any feedback or concerns.
12+
This SDK is currently in **beta**. Beta features are still in progress and may
13+
have bugs. Please reach out on
14+
[GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if
15+
you have any feedback or concerns.
1416
</Alert>
1517

16-
Sentry's Nuxt SDK enables automatic reporting of errors and performance data.
17-
18-
## Compatibility
19-
20-
The Sentry Nuxt SDK supports Nuxt version `3.7.0` and above. For best results, we recommend
21-
using Nuxt `3.14.0` or later, which includes updated dependencies critical to the SDK's functionality.
22-
2318
<PlatformContent includePath="getting-started-prerequisites" />
2419

25-
## Install
26-
27-
Sentry captures data by using an SDK within your application’s runtime.
20+
## Step 1: Install
2821

29-
We recommend installing the SDK by running our installation wizard in the root directory of your project:
22+
To install Sentry using the installation wizard, run the following command within your project:
3023

3124
```bash
3225
npx @sentry/wizard@latest -i nuxt
3326
```
3427

35-
The wizard will prompt you to log in to Sentry. It will then automatically do the following steps for you:
28+
The wizard then guides you through the setup process, asking you to enable additional (optional) Sentry features for your application beyond error monitoring.
3629

37-
- create or update Nuxt files with the default Sentry configuration:
38-
- `sentry.(client|server).config.ts` to initialize the SDK
39-
- `nuxt.config.ts` to add build options to add source maps upload and auto-instrumentation via Vite plugins.
40-
- create a `.env.sentry-build-plugin` file with an auth token to upload source maps (this file is automatically added to `.gitignore`)
41-
- add an example page to your frontend app and your server to verify your Sentry setup
30+
<PlatformContent includePath="getting-started-features-expandable" />
4231

43-
After the wizard setup is completed, the SDK will automatically capture unhandled errors, and monitor performance.
32+
This guide assumes that you enable all features and allow the wizard to create an example page or component. You can add or remove features at any time, but setting them up now will save you the effort of configuring them manually later.
4433

45-
You can also <PlatformLink to="/usage/">manually capture errors</PlatformLink>.
34+
<Expandable title="What does the installation wizard change inside your application?">
35+
- Creates `sentry.(client|server).config.ts` to initialize the SDK
36+
- Creates or updates your `nuxt.config.ts` to add build options to add source maps upload and auto-instrumentation via Vite plugins
37+
- Creates `.env.sentry-build-plugin` with an auth token to upload source maps (this file is automatically added to `.gitignore`)
38+
- Adds an example page and route to your application to help verify your Sentry setup
39+
- If it couldn't create a page, the wizard adds an example component instead
4640

47-
<Alert>
48-
If the setup through the wizard doesn't work for you, you can also <PlatformLink to="/manual-setup/">set up the SDK manually</PlatformLink>.
49-
</Alert>
41+
</Expandable>
5042

51-
## Configure
43+
## Step 2: Verify Your Setup
5244

53-
Configuration should happen as early as possible in your application's lifecycle.
45+
If you haven't tested your Sentry configuration yet, let's do it now. You can confirm that Sentry is working properly and sending data to your Sentry project by using the example page created by the installation wizard.
5446

55-
To complete your configuration, add <PlatformLink to="/configuration/options/">options</PlatformLink> to your `Sentry.init()` calls.
47+
<Expandable level="warning" title="The wizard created an example component instead of a page.">
48+
The wizard creates a `SentryErrorButton` component when it fails to add an example page to your project. This usually happens if you don't have a `app.vue` file or if that file does not contain the `NuxtPage` component. To verify your setup, follow these steps before continuing with the next section, "View Captured Data in Sentry":
5649

57-
Here, you'll also be able to set context data, which includes data about the <PlatformLink to="/enriching-events/identify-user/">user</PlatformLink>, <PlatformLink to="/enriching-events/tags/">tags</PlatformLink>, or even <PlatformLink to="/enriching-events/context/">arbitrary data</PlatformLink>, all of which will be added to every event sent to Sentry.
50+
1. Add the `SentryErrorButton` component to a page and open it in your browser. For most Nuxt applications, this will be at localhost.
51+
2. Click the "Throw Sample Error" button, which triggers an error and starts a performance trace on the client side.
5852

59-
## Verify
53+
To test the server side as well, refer to the "Verify" section in the [Manual setup guide](/platforms/javascript/guides/nuxt/manual-setup/).
6054

61-
This snippet includes an intentional error, so you can test that everything is working as soon as you set it up.
55+
</Expandable>
6256

63-
### Server-side
57+
To test Sentry on the server side, you first need to build your project since Sentry's server-side monitoring **doesn't work in development mode**.\
58+
Then run your project and make sure to load Sentry on the server side by explicitly adding it via [`--import`](/platforms/javascript/guides/nuxt/install/cli-import/):
6459

65-
Sentry can only be loaded on the server-side by being explicitly added via `--import`.
66-
Check out the <PlatformLink to="/install/cli-import">`--import` CLI flag</PlatformLink> docs for setup instructions.
60+
```
61+
# Start your app after building your project with `nuxi build`
62+
node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs
63+
```
6764

68-
To verify that Sentry works on the server-side, add the following snippet on the server-side:
65+
After building and running your project:
6966

70-
```js {tabTitle:Nitro} {filename:server/api/sentry-example.get.ts}
71-
export default defineEventHandler(event => {
72-
throw new Error("Sentry Example API Route Error");
73-
});
74-
```
67+
1. Open the example page `/sentry-example-page` in your browser. For most Nuxt applications, this will be at localhost.
68+
2. Click the "Throw sample error" button. This triggers two errors:
69+
- a frontend error
70+
- an error within the API route
7571

76-
If you want to test server-side monitoring locally, build your project and run:
77-
```
78-
# Start your app after building your project with `nuxi build`
79-
node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs
80-
```
72+
Sentry captures both of these errors for you. Additionally, the button click starts a performance trace to measure the time it takes for the API request to complete.
8173

82-
<Alert level="warning">
83-
Sentry server-side monitoring **doesn't work in development mode!**
74+
### View Captured Data in Sentry
8475

85-
If you experience any issues with the server-side setup, check out <PlatformLink to="/troubleshooting">Troubleshooting</PlatformLink>
86-
or read through the different <PlatformLink to="/install">installation methods</PlatformLink>.
87-
</Alert>
76+
Now, head over to your project on [Sentry.io](https://sentry.io/) to view the collected data (it takes a couple of moments for the data to appear).
8877

89-
### Client-side
90-
91-
Add the following snippet on the client-side:
92-
93-
```html {tabTitle:Vue} {filename:pages/example-error.vue}
94-
<script setup>
95-
import * as Sentry from '@sentry/nuxt';
96-
97-
function triggerClientError() {
98-
throw new Error("Nuxt Button Error");
99-
};
100-
101-
function getSentryData() {
102-
Sentry.startSpan(
103-
{
104-
name: 'Example Frontend Span',
105-
op: 'test'
106-
},
107-
async () => {
108-
await $fetch('/api/sentry-example');
109-
}
110-
)
111-
}
112-
</script>
113-
114-
<template>
115-
<button id="errorBtn" @click="triggerClientError">
116-
Throw Client Error
117-
</button>
118-
<button type="button" @click="getSentryData">
119-
Throw Server Error
120-
</button>
121-
</template>
122-
```
78+
<PlatformContent includePath="getting-started-browser-sandbox-warning" />
79+
80+
<PlatformContent includePath="getting-started-verify-locate-data" />
12381

124-
<Alert>
82+
## Next Steps
12583

126-
Learn more about manually capturing an error or message in our <PlatformLink to="/usage/">Usage documentation</PlatformLink>.
84+
At this point, you should have integrated Sentry into your Nuxt application and should already be sending error and performance data to your Sentry project.
12785

128-
</Alert>
86+
Now's a good time to customize your setup and look into more advanced topics. Our next recommended steps for you are:
12987

130-
To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and select your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved.
88+
- Learn how to [manually capture errors](/platforms/javascript/guides/nuxt/usage/)
89+
- Continue to [customize your configuration](/platforms/javascript/guides/nuxt/configuration/)
90+
- Get familiar with [Sentry's product features](/product) like tracing, insights, and alerts
91+
- Learn how to [track your Vue components or your Pinia store](/platforms/javascript/guides/nuxt/features/)
13192

132-
## Next Steps
93+
<Expandable permalink={false} title="Are you having problems setting up the SDK?">
94+
95+
- If you encountered issues with our installation wizard, try [setting up Sentry manually](/platforms/javascript/guides/nuxt/manual-setup/)
96+
- [Get support](https://sentry.zendesk.com/hc/en-us/)
13397

134-
- Track your Vue Components or your Pinia store by [adding support for client features](/platforms/javascript/guides/nuxt/features/)
135-
- In case you experience any issues during setup or startup, check out <PlatformLink to="/troubleshooting">Troubleshooting</PlatformLink>
136-
or read through the different <PlatformLink to="/install">installation methods</PlatformLink>.
98+
</Expandable>

docs/platforms/javascript/guides/react/index.mdx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,7 @@ Choose the features you want to configure, and this guide will show you how:
1717
options={["error-monitoring", "performance", "session-replay"]}
1818
/>
1919

20-
<Expandable title="Want to learn more about these features?">
21-
22-
- [**Issues**](/product/issues) (always enabled): Sentry's core error monitoring product that automatically reports errors,
23-
uncaught exceptions, and unhandled rejections. If you have something that
24-
looks like an exception, Sentry can capture it.
25-
- [**Tracing**](/product/tracing): Track software performance while seeing the
26-
impact of errors across multiple systems. For example, distributed tracing
27-
allows you to follow a request from the frontend to the backend and back.
28-
- [**Session Replay**](/product/explore/session-replay/web):
29-
Get to the root cause of an issue faster by viewing a video-like reproduction
30-
of what was happening in the user's browser before, during, and after the
31-
problem.
32-
33-
</Expandable>
20+
<PlatformContent includePath="getting-started-features-expandable" />
3421

3522
### Install the Sentry SDK
3623

docs/platforms/javascript/guides/tanstackstart-react/index.mdx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,7 @@ Choose the features you want to configure, and this guide will show you how:
1313
options={["error-monitoring", "performance", "session-replay"]}
1414
/>
1515

16-
<Expandable title="Want to learn more about these features?">
17-
18-
- [**Issues**](/product/issues) (always enabled): Sentry's core error monitoring product that automatically reports errors,
19-
uncaught exceptions, and unhandled rejections. If you have something that
20-
looks like an exception, Sentry can capture it.
21-
- [**Tracing**](/product/tracing): Track software performance while seeing the
22-
impact of errors across multiple systems. For example, distributed tracing
23-
allows you to follow a request from the frontend to the backend and back.
24-
- [**Session Replay**](/product/explore/session-replay/web):
25-
Get to the root cause of an issue faster by viewing a video-like reproduction
26-
of what was happening in the user's browser before, during, and after the
27-
problem.
28-
29-
</Expandable>
16+
<PlatformContent includePath="getting-started-features-expandable" />
3017

3118
Run the command for your preferred package manager to add the SDK package to your application:
3219

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Expandable title="Want to learn more about these features?">
2+
3+
- [**Issues**](/product/issues) (always enabled): Sentry's core error monitoring product that automatically reports errors,
4+
uncaught exceptions, and unhandled rejections. If you have something that
5+
looks like an exception, Sentry can capture it.
6+
- [**Tracing**](/product/tracing): Track software performance while seeing the
7+
impact of errors across multiple systems. For example, distributed tracing
8+
allows you to follow a request from the frontend to the backend and back.
9+
- [**Session Replay**](/product/explore/session-replay/web):
10+
Get to the root cause of an issue faster by viewing a video-like reproduction
11+
of what was happening in the user's browser before, during, and after the
12+
problem.
13+
14+
</Expandable>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Expandable title="Want to learn more about these features?">
2+
3+
- [**Issues**](/product/issues) (always enabled): Sentry's core error monitoring product that automatically reports errors,
4+
uncaught exceptions, and unhandled rejections. If you have something that
5+
looks like an exception, Sentry can capture it.
6+
- [**Tracing**](/product/tracing): Track software performance while seeing the
7+
impact of errors across multiple systems. For example, distributed tracing
8+
allows you to follow a request from the frontend to the backend and back.
9+
- [**Profiling**](/product/explore/profiling/): Gain deeper insight than traditional tracing without custom instrumentation, letting you discover slow-to-execute or resource-intensive functions in your app.
10+
11+
</Expandable>

platform-includes/getting-started-node/javascript.mdx

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,7 @@ Choose the features you want to configure, and this guide will show you how:
88
options={["error-monitoring", "performance", "profiling"]}
99
/>
1010

11-
<Expandable title="Want to learn more about these features?">
12-
13-
- [**Issues**](/product/issues) (always enabled): Sentry's core error monitoring product that automatically reports errors,
14-
uncaught exceptions, and unhandled rejections. If you have something that
15-
looks like an exception, Sentry can capture it.
16-
- [**Tracing**](/product/tracing): Track software performance while seeing the
17-
impact of errors across multiple systems. For example, distributed tracing
18-
allows you to follow a request from the frontend to the backend and back.
19-
- [**Profiling**](/product/explore/profiling/): Gain deeper insight than traditional tracing without custom instrumentation, letting you discover slow-to-execute or resource-intensive functions in your app.
20-
21-
</Expandable>
11+
<PlatformContent includePath="getting-started-features-expandable" />
2212

2313
### Install the Sentry SDK
2414

@@ -78,13 +68,7 @@ Let's test your setup and confirm that Sentry is working correctly and sending d
7868

7969
Now, head over to your project on [Sentry.io](https://sentry.io/) to view the collected data (it takes a couple of moments for the data to appear).
8070

81-
<Expandable title="Need help locating the captured errors in your Sentry project?">
82-
83-
1. Open the [**Issues**](https://sentry.io/orgredirect/organizations/:orgslug/issues) page and select an error from the issues list to view the full details and context of this error. For an interactive UI walkthrough, click [here](/product/sentry-basics/integrate-frontend/generate-first-error/#ui-walkthrough).
84-
2. Open the [**Traces**](https://sentry.io/orgredirect/organizations/:orgslug/traces) page and select a trace to reveal more information about each span, its duration, and any errors. For an interactive UI walkthrough, click [here](/product/sentry-basics/distributed-tracing/generate-first-error/#ui-walkthrough).
85-
3. Open the [**Profiles**](https://sentry.io/orgredirect/organizations/:orgslug/profiling) page, select a transaction, and then a profile ID to view its flame graph. For more information, click [here](/product/explore/profiling/profile-details/).
86-
87-
</Expandable>
71+
<PlatformContent includePath="getting-started-verify-locate-data" />
8872

8973
## Next Steps
9074

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Prerequisites
2+
3+
You need:
4+
5+
- A Sentry [account](https://sentry.io/signup/) and [project](/product/projects/)
6+
- Your application up and running
7+
- Nuxt version `3.7.0` or above (`3.14.0`+ recommended)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Expandable title="Need help locating the captured errors in your Sentry project?">
2+
3+
1. Open the [**Issues**](https://sentry.io/orgredirect/organizations/:orgslug/issues) page and select an error from the issues list to view the full details and context of this error. For an interactive UI walkthrough, click [here](/product/sentry-basics/integrate-frontend/generate-first-error/#ui-walkthrough).
4+
2. Open the [**Traces**](https://sentry.io/orgredirect/organizations/:orgslug/traces) page and select a trace to reveal more information about each span, its duration, and any errors. For an interactive UI walkthrough, click [here](/product/sentry-basics/distributed-tracing/generate-first-error/#ui-walkthrough).
5+
3. Open the [**Profiles**](https://sentry.io/orgredirect/organizations/:orgslug/profiling) page, select a transaction, and then a profile ID to view its flame graph. For more information, click [here](/product/explore/profiling/profile-details/).
6+
7+
</Expandable>

0 commit comments

Comments
 (0)