Skip to content

Commit ea17942

Browse files
authored
docs(nuxt): Add docs for Cloudflare Nitro plugin (#14219)
## DESCRIBE YOUR PR Docs for getsentry/sentry-javascript#15597 closes getsentry/sentry-javascript#16780 ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [ ] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs)
1 parent aa77c6e commit ea17942

File tree

5 files changed

+80
-3
lines changed

5 files changed

+80
-3
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: Nuxt on Cloudflare
3+
description: "Learn how to add Cloudflare instrumentation to your Nuxt app."
4+
---
5+
6+
If you're running your Nuxt app on Cloudflare Pages, you'll need to configure the Sentry Nuxt SDK slightly differently than the default setup.
7+
This guide will show you how to set up the SDK with Nitro's `cloudflare-pages` deployment preset.
8+
9+
## Install
10+
11+
First, install the Sentry Nuxt SDK in your application. We recommend using the Sentry wizard to automatically install the SDK:
12+
13+
```bash
14+
npx @sentry/wizard@latest -i nuxt
15+
```
16+
17+
If the setup through the wizard doesn't work for you, you can also [set up the Nuxt SDK manually](/platforms/javascript/guides/nuxt/manual-setup/).
18+
19+
<Alert>
20+
21+
If you installed the SDK before, make sure that `@sentry/nuxt` version `9.34.0` or newer is installed.
22+
23+
</Alert>
24+
25+
Now you can install the Sentry Cloudflare SDK with your package manager:
26+
27+
<PlatformContent includePath="getting-started-install" />
28+
29+
## Setup
30+
31+
<PlatformContent includePath="getting-started-config" />
32+
33+
### Adding the Nitro Plugin
34+
35+
To enable Sentry for your Nuxt app on Cloudflare, follow these steps:
36+
37+
1. Delete the previous server config file `sentry.server.config.ts` if it exists.
38+
39+
2. Create a new file in `server/plugins` and add the following code to your plugin file:
40+
41+
```TypeScript {filename:server/plugins/sentry-cloudflare-plugin.ts}
42+
import { sentryCloudflareNitroPlugin } from '@sentry/nuxt/module/plugins'
43+
44+
export default defineNitroPlugin(sentryCloudflareNitroPlugin({
45+
dsn: '___PUBLIC_DSN___',
46+
tracesSampleRate: 1.0,
47+
}))
48+
```
49+
50+
Or, if you need access to `nitroApp`:
51+
52+
```TypeScript {filename:server/plugins/sentry-cloudflare-plugin.ts}
53+
import { sentryCloudflareNitroPlugin } from '@sentry/nuxt/module/plugins'
54+
55+
export default defineNitroPlugin(sentryCloudflareNitroPlugin((nitroApp: NitroApp) => {
56+
// You can access `nitroApp` here if needed
57+
return {
58+
dsn: '___PUBLIC_DSN___',
59+
tracesSampleRate: 1.0,
60+
}
61+
}))
62+
```
63+
64+
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Vue Features
3-
description: "Learn how to exposes features for first class integration with Vue with Sentry's Nuxt SDK."
2+
title: Nuxt Features
3+
description: "Learn how to use Sentry's Nuxt SDK for first-class integration with Vue and Nitro."
44
sidebar_order: 4
55
---
66

7-
The Sentry Nuxt SDK offers Vue-specific features for first class integration with the framework.
7+
The Sentry Nuxt SDK offers support for Vue and Nitro-specific features for first-class integration with the framework.
88

99
<PageGrid />
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: Nitro Deployment Presets
3+
description: "Learn how to set up monitoring of your application when using different Nitro deployment presets."
4+
sidebar_order: 10
5+
---
6+
7+
The Sentry Nuxt SDK provides support for different Nitro deployment presets, most of which **work out of the box**.
8+
9+
## Cloudflare Pages
10+
11+
Using the Cloudflare Nitro plugin of Sentry enables Sentry monitoring on Cloudflare Pages. Go and see the [Cloudflare Nitro plugin documentation](/platforms/javascript/guides/cloudflare/frameworks/nuxt).

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ Now's a good time to customize your setup and look into more advanced topics. Ou
9393
- Continue to [customize your configuration](/platforms/javascript/guides/nuxt/configuration/)
9494
- Get familiar with [Sentry's product features](/product) like tracing, insights, and alerts
9595
- Learn how to [track your Vue components or your Pinia store](/platforms/javascript/guides/nuxt/features/)
96+
- Learn how to [add support for different Nitro deployment presets](/platforms/javascript/guides/nuxt/features/nitro-deployment-presets/) (like Cloudflare)
9697

9798
<Expandable permalink={false} title="Are you having problems setting up the SDK?">
9899

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ Now's a good time to customize your setup and look into more advanced topics. Ou
343343
- Continue to [customize your configuration](/platforms/javascript/guides/nuxt/configuration/)
344344
- Get familiar with [Sentry's product features](/product) like tracing, insights, and alerts
345345
- Learn how to [track your Vue components or your Pinia store](/platforms/javascript/guides/nuxt/features/)
346+
- Learn how to [add support for different Nitro deployment presets](/platforms/javascript/guides/nuxt/features/nitro-deployment-presets/) (like Cloudflare)
346347

347348
<Expandable permalink={false} title="Are you having problems setting up the SDK?">
348349

0 commit comments

Comments
 (0)