Title: [Nuxt] Disable Sentry module by adding `sentry.enabled` to Nuxt config · Issue #14935 · getsentry/sentry-javascript · GitHub
Open Graph Title: [Nuxt] Disable Sentry module by adding `sentry.enabled` to Nuxt config · Issue #14935 · getsentry/sentry-javascript
X Title: [Nuxt] Disable Sentry module by adding `sentry.enabled` to Nuxt config · Issue #14935 · getsentry/sentry-javascript
Description: Problem Statement Context When running unit tests using the defineVitestConfig method from @nuxt/test-utils/config package, it will read the nuxt.config.ts file and setup the @sentry/nuxt module if found in the modules array. This causes...
Open Graph Description: Problem Statement Context When running unit tests using the defineVitestConfig method from @nuxt/test-utils/config package, it will read the nuxt.config.ts file and setup the @sentry/nuxt module if...
X Description: Problem Statement Context When running unit tests using the defineVitestConfig method from @nuxt/test-utils/config package, it will read the nuxt.config.ts file and setup the @sentry/nuxt module if...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/14935
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Nuxt] Disable Sentry module by adding `sentry.enabled` to Nuxt config","articleBody":"### Problem Statement\n\n## Context\n\nWhen running unit tests using the `defineVitestConfig` method from `@nuxt/test-utils/config` package, it will read the `nuxt.config.ts` file and setup the `@sentry/nuxt` module if found in the `modules` array.\n\nThis causes the sentry vite plugin to boot and it logs warnings from sentry:\n```\n[Sentry] Enabled source map generation in the build options with `nitro.rollupConfig.output.sourcemap: hidden`.\nmodule.mjs:367\n[Sentry] Disabled source map setting in the Nuxt config: `nitro.rollupConfig.output.sourcemapExcludeSources`. Source maps will include the actual code to be able to un-minify code snippets in Sentry.\nmodule.mjs:343\n[Sentry] Setting `sentry.sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload: [\".*/**/public/**/*.map\"]` to delete generated source maps after they were uploaded to Sentry.\nmodule.mjs:227\n[sentry-rollup-plugin] Warning: No auth token provided. Will not create release. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/\nindex.mjs:8919\n[sentry-rollup-plugin] Warning: No auth token provided. Will not upload source maps. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/\nindex.mjs:8919\n[sentry-vite-plugin] Warning: No auth token provided. Will not create release. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/\nindex.mjs:8919\n[sentry-vite-plugin] Warning: No auth token provided. Will not upload source maps. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/\nindex.mjs:8919\n[sentry-vite-plugin] Info: Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.\n```\n\nNote: the \"_No auth token provided_\" warning is because the environment variable I configured is not available in test mode.\n\n## Expected behaviour\n\nI want to be able to disable the Sentry module during test mode, so I don't have these logs everytime I run the tests, and also because it seems like Sentry is gonna run along with my tests, which I don't really want.\n\nA workaround I found is to conditionally add the module depending on the NODE_ENV variable:\n```ts\n// nuxt.config.ts\n modules: [\n process.env.NODE_ENV !== 'test' && '@sentry/nuxt/module',\n ],\n```\n\nDoing so, the module is not added and therefore not setup in my test environment.\n\n### Solution Brainstorm\n\nMaybe simply an `enabled` configuration boolean on the module so we can opt-out conditionally?\n\n```ts\n// nuxt.config.ts\n\nsentry: {\n enabled: process.env.NODE_ENV !== 'test',\n},\n```","author":{"url":"https://github.com/Kapcash","@type":"Person","name":"Kapcash"},"datePublished":"2025-01-08T10:17:15Z","url":"https://github.com/getsentry/sentry-javascript/issues/14935"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e5dc3be0-4450-aef5-598a-4621d5f6e135 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EDAA:1D7C40:0AE6:0E32:6B041577 |
| html-safe-nonce | bd7b9a5cbdcbe262006a36c38278a29dc751e2452f6c4c21a5c0ff59f9ad3307 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFREFBOjFEN0M0MDowQUU2OjBFMzI6NkIwNDE1NzciLCJ2aXNpdG9yX2lkIjoiMTk2NzU3NjgxMTMxOTg1ODU1MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ac91e681fe80a3e28aa216e166609fd6259f8ba3b8b41afa23e3280e6aa41c34 |
| hovercard-subject-tag | issue:2774967012 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/14935/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2b11491c1cf9d6f2740302e2775825ffb0d709e8601eb3fddc24c00c77ab012d/getsentry/sentry-javascript/issues/14935 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2b11491c1cf9d6f2740302e2775825ffb0d709e8601eb3fddc24c00c77ab012d/getsentry/sentry-javascript/issues/14935 |
| og:image:alt | Problem Statement Context When running unit tests using the defineVitestConfig method from @nuxt/test-utils/config package, it will read the nuxt.config.ts file and setup the @sentry/nuxt module if... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Kapcash |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width