-
Notifications
You must be signed in to change notification settings - Fork 212
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
Add Sentry Nuxt module #5279
Add Sentry Nuxt module #5279
Changes from 5 commits
0dec8eb
41b42ac
57f364e
be2f45f
14f145a
aca9a67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,15 +63,15 @@ | |
"@nuxtjs/sitemap": "^7.0.0", | ||
"@nuxtjs/tailwindcss": "^6.12.1", | ||
"@pinia/nuxt": "^0.9.0", | ||
"@sentry/node": "^8.26.0", | ||
"@sentry/vue": "^8.26.0", | ||
"@sentry/nuxt": "^8.45.0", | ||
"@tailwindcss/typography": "^0.5.13", | ||
"@vueuse/core": "^12.0.0", | ||
"@wordpress/is-shallow-equal": "^5.3.0", | ||
"async-mutex": "^0.5.0", | ||
"axios": "^1.7.2", | ||
"axios-mock-adapter": "^1.22.0", | ||
"clipboard": "^2.0.11", | ||
"dotenv": "^16.4.7", | ||
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. This surprised me because I had read that Nuxt has 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. Right, we already had it in the lock file due to Nuxt. I added it because it was mentioned in the Nuxt Sentry module setup docs, but removed it after your comment. |
||
"focus-trap": "^7.5.4", | ||
"focus-visible": "^5.2.0", | ||
"pinia": "^2.2.5", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { useAppConfig, useRuntimeConfig } from "#imports" | ||
|
||
import * as Sentry from "@sentry/nuxt" | ||
|
||
Sentry.init({ | ||
dsn: useRuntimeConfig().public.sentry.dsn, | ||
environment: useRuntimeConfig().public.sentry.environment, | ||
release: useAppConfig().semanticVersion, | ||
ignoreErrors: [ | ||
// Can be safely ignored, @see https://github.com/WICG/resize-observer/issues/38 | ||
/ResizeObserver loop limit exceeded/i, | ||
], | ||
|
||
tracesSampleRate: 1.0, | ||
}) | ||
Sentry.setContext("render context", { platform: "client" }) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as Sentry from "@sentry/nuxt" | ||
import dotenv from "dotenv" | ||
|
||
// Necessary for loading environment variables before Nuxt is loaded | ||
// @see the section on server setup: https://nuxt.com/modules/sentry | ||
dotenv.config() | ||
|
||
Sentry.init({ | ||
dsn: process.env.NUXT_PUBLIC_SENTRY_DSN, | ||
environment: process.env.NUXT_PUBLIC_SENTRY_ENVIRONMENT, | ||
release: process.env.SEMANTIC_VERSION, | ||
|
||
tracesSampleRate: 1.0, | ||
}) | ||
Sentry.setContext("render context", { platform: "server" }) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,13 @@ | ||
import { defineNuxtPlugin, useRuntimeConfig, useAppConfig } from "#imports" | ||
import { defineNuxtPlugin } from "#imports" | ||
|
||
import * as Sentry from "@sentry/vue" | ||
|
||
export default defineNuxtPlugin((nuxtApp) => { | ||
const { | ||
public: { sentry }, | ||
} = useRuntimeConfig() | ||
|
||
const { semanticVersion } = useAppConfig() | ||
|
||
if (!sentry.dsn) { | ||
console.warn("Sentry DSN wasn't provided") | ||
} | ||
|
||
Sentry.init({ | ||
dsn: sentry.dsn, | ||
environment: sentry.environment, | ||
release: semanticVersion, | ||
app: nuxtApp.vueApp, | ||
ignoreErrors: [ | ||
// Can be safely ignored, @see https://github.com/WICG/resize-observer/issues/38 | ||
/ResizeObserver loop limit exceeded/i, | ||
], | ||
}) | ||
Sentry.setContext("render context", { platform: "client" }) | ||
import * as Sentry from "@sentry/nuxt" | ||
|
||
export default defineNuxtPlugin(() => { | ||
const { captureException, captureMessage } = Sentry | ||
return { | ||
provide: { | ||
sentry: Sentry, | ||
captureException, | ||
captureMessage, | ||
}, | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for this being named
.env.sentry-build-plugin
? Could it be similar to the env setup for other other packages so that we can reuse the existing workflow (.env
file created fromenv.template
using theenv
recipe etc.)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added by the Sentry module wizard. I added the env variable to the GitHub repository, so it's not really necessary anymore.