-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
docs(nuxt): Add additional information in readme #12850
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
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -28,18 +28,30 @@ The minimum supported version of Nuxt is `3.0.0`. | |||||
This package is a wrapper around `@sentry/node` for the server and `@sentry/vue` for the client side, with added | ||||||
functionality related to Nuxt. | ||||||
|
||||||
What is working: | ||||||
**What is working:** | ||||||
|
||||||
- Error Reporting | ||||||
- Vue | ||||||
- Node | ||||||
- Nitro | ||||||
|
||||||
What is partly working: | ||||||
**What is partly working:** | ||||||
|
||||||
- Tracing by setting `tracesSampleRate` | ||||||
- UI (Vue) traces | ||||||
- HTTP (Node) traces | ||||||
|
||||||
What is not yet(!) included: | ||||||
**What is not yet(!) included:** | ||||||
|
||||||
- Source Maps | ||||||
- Connected Traces | ||||||
- Nuxt-specific traces and no connected traces | ||||||
|
||||||
**Known Issues:** | ||||||
|
||||||
- When adding `sentry.server.config.(ts/js)`, you get this error: "Failed to register ESM hook", but the application | ||||||
will still work | ||||||
- When initializing Sentry on the server with `instrument.server.(js|ts)`, you get an `'import-in-the-middle'` error, | ||||||
and the application won't work | ||||||
|
||||||
## Automatic Setup | ||||||
|
||||||
|
@@ -96,10 +108,38 @@ Add a `sentry.server.config.(js|ts)` file to the root of your project: | |||||
import * as Sentry from '@sentry/nuxt'; | ||||||
|
||||||
Sentry.init({ | ||||||
dsn: env.DSN, | ||||||
dsn: process.env.DSN, | ||||||
}); | ||||||
``` | ||||||
|
||||||
**Alternative Setup (ESM-compatible)** | ||||||
|
||||||
This setup makes sure Sentry is imported on the server before any other imports. This however leads to an | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
import-in-the-middle error ([related reproduction](https://github.com/getsentry/sentry-javascript-examples/pull/38)). | ||||||
|
||||||
Add a `instrument.server.(js|ts)` file to your `public` folder: | ||||||
|
||||||
```javascript | ||||||
import * as Sentry from '@sentry/nuxt'; | ||||||
|
||||||
// Only run `init` when DSN is available | ||||||
if (process.env.SENTRY_DSN) { | ||||||
Sentry.init({ | ||||||
dsn: process.env.DSN, | ||||||
}); | ||||||
} | ||||||
``` | ||||||
|
||||||
Add an import flag to the node options, so the file loads before any other imports: | ||||||
|
||||||
```json | ||||||
{ | ||||||
"scripts": { | ||||||
"preview": "NODE_OPTIONS='--import ./public/instrument.server.mjs' nuxt preview" | ||||||
} | ||||||
} | ||||||
``` | ||||||
|
||||||
### 5. Vite Setup | ||||||
|
||||||
todo: add vite setup | ||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.