Skip to content

fix(nuxt): Add @sentry/cloudflare as optional peerDependency #16782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions docs/creating-a-new-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,34 @@ provide an abstraction layer of options that we expose on top of that.
We generally want to support Node runtimes for the server. However, sometimes there may be alternate runtimes that may
be supported, e.g. Cloudflare Workers or Vercel Edge Functions. We generally do not need to support these in an MVP, but
may decide to support them later.

#### Cloudflare Workers/Pages

To add support for Cloudflare Workers or Pages in a specific SDK, you need to do the following:

1. Add `@sentry/cloudflare` as an optional peer dependency to the `package.json` of the SDK.
This ensures that users who want to use the SDK with Cloudflare will install the necessary package, but it won't be a requirement for users on other platforms.

```json
"peerDependencies": {
"@sentry/cloudflare": ">=9.33.0"
},
"peerDependenciesMeta": {
"@sentry/cloudflare": {
"optional": true
}
}
```

2. Add `@sentry/cloudflare` to the `devDependencies` in the SDK's `package.json`.
This is necessary for local development and testing, allowing you to use the Cloudflare-specific APIs in the development environment.

```json
"devDependencies": {
"@sentry/cloudflare": "9.33.0",
}
```

3. Add documentation to the [Cloudflare Frameworks docs](https://docs.sentry.io/platforms/javascript/guides/cloudflare/frameworks/) explaining how to set up the SDK for Cloudflare Workers/Pages.
This documentation should include instructions for users to add the `@sentry/cloudflare` package to their project.
You can then link from the framework-specific docs pages to the Cloudflare SDK docs page by adding an entry to "Next Steps" on the "Getting Started" and "Manual Setup" pages.
10 changes: 8 additions & 2 deletions packages/nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@
"access": "public"
},
"peerDependencies": {
"nuxt": ">=3.7.0 || 4.x"
"nuxt": ">=3.7.0 || 4.x",
"@sentry/cloudflare": ">=9.34.0"
},
"peerDependenciesMeta": {
"@sentry/cloudflare": {
"optional": true
}
},
"dependencies": {
"@nuxt/kit": "^3.13.2",
"@sentry/browser": "9.34.0",
"@sentry/cloudflare": "9.34.0",
"@sentry/core": "9.34.0",
"@sentry/node": "9.34.0",
"@sentry/rollup-plugin": "^3.5.0",
Expand All @@ -57,6 +62,7 @@
},
"devDependencies": {
"@nuxt/module-builder": "^0.8.4",
"@sentry/cloudflare": "9.34.0",
"nuxt": "^3.13.2"
},
"scripts": {
Expand Down
Loading