@sentry/nuxt 8.31.0 → 8.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  const core = require('@sentry/core');
2
2
  const vue = require('@sentry/vue');
3
3
  const app = require('nuxt/app');
4
+ const utils = require('../utils.js');
4
5
 
5
6
  // --- Types are copied from @sentry/vue (so it does not need to be exported) ---
6
7
  // The following type is an intersection of the Route type from VueRouter v2, v3, and v4.
@@ -26,9 +27,20 @@ const sentry_client = app.defineNuxtPlugin({
26
27
  const sentryClient = core.getClient();
27
28
 
28
29
  if (sentryClient) {
29
- sentryClient.addIntegration(vue.vueIntegration({ app: vueApp }));
30
+ // Adding the Vue integration without the Vue error handler
31
+ // Nuxt is registering their own error handler, which is unset after hydration: https://github.com/nuxt/nuxt/blob/d3fdbcaac6cf66d21e25d259390d7824696f1a87/packages/nuxt/src/app/entry.ts#L64-L73
32
+ // We don't want to wrap the existing error handler, as it leads to a 500 error: https://github.com/getsentry/sentry-javascript/issues/12515
33
+ sentryClient.addIntegration(vue.vueIntegration({ app: vueApp, attachErrorHandler: false }));
30
34
  }
31
35
  });
36
+
37
+ nuxtApp.hook('app:error', error => {
38
+ utils.reportNuxtError({ error });
39
+ });
40
+
41
+ nuxtApp.hook('vue:error', (error, instance, info) => {
42
+ utils.reportNuxtError({ error, instance, info });
43
+ });
32
44
  },
33
45
  });
34
46
 
@@ -1 +1 @@
1
- {"version":3,"file":"sentry.client.js","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"sourcesContent":["import { getClient } from '@sentry/core';\nimport { browserTracingIntegration, vueIntegration } from '@sentry/vue';\nimport { defineNuxtPlugin } from 'nuxt/app';\n\n// --- Types are copied from @sentry/vue (so it does not need to be exported) ---\n// The following type is an intersection of the Route type from VueRouter v2, v3, and v4.\n// This is not great, but kinda necessary to make it work with all versions at the same time.\ntype Route = {\n /** Unparameterized URL */\n path: string;\n /**\n * Query params (keys map to null when there is no value associated, e.g. \"?foo\" and to an array when there are\n * multiple query params that have the same key, e.g. \"?foo&foo=bar\")\n */\n query: Record<string, string | null | (string | null)[]>;\n /** Route name (VueRouter provides a way to give routes individual names) */\n name?: string | symbol | null | undefined;\n /** Evaluated parameters */\n params: Record<string, string | string[]>;\n /** All the matched route objects as defined in VueRouter constructor */\n matched: { path: string }[];\n};\n\ninterface VueRouter {\n onError: (fn: (err: Error) => void) => void;\n beforeEach: (fn: (to: Route, from: Route, next?: () => void) => void) => void;\n}\n\n// Tree-shakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\nexport default defineNuxtPlugin({\n name: 'sentry-client-integrations',\n dependsOn: ['sentry-client-config'],\n async setup(nuxtApp) {\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\", in which case everything inside\n // will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n const sentryClient = getClient();\n\n if (sentryClient && '$router' in nuxtApp) {\n sentryClient.addIntegration(\n browserTracingIntegration({ router: nuxtApp.$router as VueRouter, routeLabel: 'path' }),\n );\n }\n }\n\n nuxtApp.hook('app:created', vueApp => {\n const sentryClient = getClient();\n\n if (sentryClient) {\n sentryClient.addIntegration(vueIntegration({ app: vueApp }));\n }\n });\n },\n});\n"],"names":["defineNuxtPlugin","getClient","browserTracingIntegration","vueIntegration"],"mappings":";;;;AAIA;AACA;AACA;;AAyBA,sBAAeA,oBAAgB,CAAC;AAChC,EAAE,IAAI,EAAE,4BAA4B;AACpC,EAAE,SAAS,EAAE,CAAC,sBAAsB,CAAC;AACrC,EAAE,MAAM,KAAK,CAAC,OAAO,EAAE;AACvB;AACA;AACA,IAAI,IAAI,OAAO,kBAAA,KAAuB,WAAY,IAAG,kBAAkB,EAAE;AACzE,MAAM,MAAM,YAAA,GAAeC,cAAS,EAAE,CAAA;AACtC;AACA,MAAM,IAAI,YAAA,IAAgB,SAAU,IAAG,OAAO,EAAE;AAChD,QAAQ,YAAY,CAAC,cAAc;AACnC,UAAUC,6BAAyB,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,OAAA,GAAsB,UAAU,EAAE,MAAA,EAAQ,CAAC;AACjG,SAAS,CAAA;AACT,OAAM;AACN,KAAI;AACJ;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU;AAC1C,MAAM,MAAM,YAAA,GAAeD,cAAS,EAAE,CAAA;AACtC;AACA,MAAM,IAAI,YAAY,EAAE;AACxB,QAAQ,YAAY,CAAC,cAAc,CAACE,kBAAc,CAAC,EAAE,GAAG,EAAE,MAAA,EAAQ,CAAC,CAAC,CAAA;AACpE,OAAM;AACN,KAAK,CAAC,CAAA;AACN,GAAG;AACH,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"sentry.client.js","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"sourcesContent":["import { getClient } from '@sentry/core';\nimport { browserTracingIntegration, vueIntegration } from '@sentry/vue';\nimport { defineNuxtPlugin } from 'nuxt/app';\nimport { reportNuxtError } from '../utils';\n\n// --- Types are copied from @sentry/vue (so it does not need to be exported) ---\n// The following type is an intersection of the Route type from VueRouter v2, v3, and v4.\n// This is not great, but kinda necessary to make it work with all versions at the same time.\ntype Route = {\n /** Unparameterized URL */\n path: string;\n /**\n * Query params (keys map to null when there is no value associated, e.g. \"?foo\" and to an array when there are\n * multiple query params that have the same key, e.g. \"?foo&foo=bar\")\n */\n query: Record<string, string | null | (string | null)[]>;\n /** Route name (VueRouter provides a way to give routes individual names) */\n name?: string | symbol | null | undefined;\n /** Evaluated parameters */\n params: Record<string, string | string[]>;\n /** All the matched route objects as defined in VueRouter constructor */\n matched: { path: string }[];\n};\n\ninterface VueRouter {\n onError: (fn: (err: Error) => void) => void;\n beforeEach: (fn: (to: Route, from: Route, next?: () => void) => void) => void;\n}\n\n// Tree-shakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\nexport default defineNuxtPlugin({\n name: 'sentry-client-integrations',\n dependsOn: ['sentry-client-config'],\n async setup(nuxtApp) {\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\", in which case everything inside\n // will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n const sentryClient = getClient();\n\n if (sentryClient && '$router' in nuxtApp) {\n sentryClient.addIntegration(\n browserTracingIntegration({ router: nuxtApp.$router as VueRouter, routeLabel: 'path' }),\n );\n }\n }\n\n nuxtApp.hook('app:created', vueApp => {\n const sentryClient = getClient();\n\n if (sentryClient) {\n // Adding the Vue integration without the Vue error handler\n // Nuxt is registering their own error handler, which is unset after hydration: https://github.com/nuxt/nuxt/blob/d3fdbcaac6cf66d21e25d259390d7824696f1a87/packages/nuxt/src/app/entry.ts#L64-L73\n // We don't want to wrap the existing error handler, as it leads to a 500 error: https://github.com/getsentry/sentry-javascript/issues/12515\n sentryClient.addIntegration(vueIntegration({ app: vueApp, attachErrorHandler: false }));\n }\n });\n\n nuxtApp.hook('app:error', error => {\n reportNuxtError({ error });\n });\n\n nuxtApp.hook('vue:error', (error, instance, info) => {\n reportNuxtError({ error, instance, info });\n });\n },\n});\n"],"names":["defineNuxtPlugin","getClient","browserTracingIntegration","vueIntegration","reportNuxtError"],"mappings":";;;;;AAKA;AACA;AACA;;AAyBA,sBAAeA,oBAAgB,CAAC;AAChC,EAAE,IAAI,EAAE,4BAA4B;AACpC,EAAE,SAAS,EAAE,CAAC,sBAAsB,CAAC;AACrC,EAAE,MAAM,KAAK,CAAC,OAAO,EAAE;AACvB;AACA;AACA,IAAI,IAAI,OAAO,kBAAA,KAAuB,WAAY,IAAG,kBAAkB,EAAE;AACzE,MAAM,MAAM,YAAA,GAAeC,cAAS,EAAE,CAAA;AACtC;AACA,MAAM,IAAI,YAAA,IAAgB,SAAU,IAAG,OAAO,EAAE;AAChD,QAAQ,YAAY,CAAC,cAAc;AACnC,UAAUC,6BAAyB,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,OAAA,GAAsB,UAAU,EAAE,MAAA,EAAQ,CAAC;AACjG,SAAS,CAAA;AACT,OAAM;AACN,KAAI;AACJ;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU;AAC1C,MAAM,MAAM,YAAA,GAAeD,cAAS,EAAE,CAAA;AACtC;AACA,MAAM,IAAI,YAAY,EAAE;AACxB;AACA;AACA;AACA,QAAQ,YAAY,CAAC,cAAc,CAACE,kBAAc,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAM,EAAC,CAAC,CAAC,CAAA;AAC/F,OAAM;AACN,KAAK,CAAC,CAAA;AACN;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS;AACvC,MAAMC,qBAAe,CAAC,EAAE,KAAA,EAAO,CAAC,CAAA;AAChC,KAAK,CAAC,CAAA;AACN;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,KAAK;AACzD,MAAMA,qBAAe,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAK,EAAC,CAAC,CAAA;AAChD,KAAK,CAAC,CAAA;AACN,GAAG;AACH,CAAC,CAAC;;;;"}
@@ -41,6 +41,42 @@ function addSentryTracingMetaTags(head) {
41
41
  }
42
42
  }
43
43
 
44
+ /**
45
+ * Reports an error to Sentry. This function is similar to `attachErrorHandler` in `@sentry/vue`.
46
+ * The Nuxt SDK does not register an error handler, but uses the Nuxt error hooks to report errors.
47
+ *
48
+ * We don't want to use the error handling from `@sentry/vue` as it wraps the existing error handler, which leads to a 500 error: https://github.com/getsentry/sentry-javascript/issues/12515
49
+ */
50
+ function reportNuxtError(options
51
+
52
+ ) {
53
+ const { error, instance, info } = options;
54
+
55
+ const metadata = {
56
+ info,
57
+ // todo: add component name and trace (like in the vue integration)
58
+ };
59
+
60
+ if (instance && instance.$props) {
61
+ const sentryClient = core.getClient();
62
+ const sentryOptions = sentryClient ? (sentryClient.getOptions() ) : null;
63
+
64
+ // `attachProps` is enabled by default and props should only not be attached if explicitly disabled (see DEFAULT_CONFIG in `vueIntegration`).
65
+ if (sentryOptions && sentryOptions.attachProps && instance.$props !== false) {
66
+ metadata.propsData = instance.$props;
67
+ }
68
+ }
69
+
70
+ // Capture exception in the next event loop, to make sure that all breadcrumbs are recorded in time.
71
+ setTimeout(() => {
72
+ core.captureException(error, {
73
+ captureContext: { contexts: { nuxt: metadata } },
74
+ mechanism: { handled: false },
75
+ });
76
+ });
77
+ }
78
+
44
79
  exports.addSentryTracingMetaTags = addSentryTracingMetaTags;
45
80
  exports.extractErrorContext = extractErrorContext;
81
+ exports.reportNuxtError = reportNuxtError;
46
82
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/runtime/utils.ts"],"sourcesContent":["import { getTraceMetaTags } from '@sentry/core';\nimport type { Context } from '@sentry/types';\nimport { dropUndefinedKeys } from '@sentry/utils';\nimport type { CapturedErrorContext } from 'nitropack';\nimport type { NuxtRenderHTMLContext } from 'nuxt/app';\n\n/**\n * Extracts the relevant context information from the error context (H3Event in Nitro Error)\n * and created a structured context object.\n */\nexport function extractErrorContext(errorContext: CapturedErrorContext): Context {\n const structuredContext: Context = {\n method: undefined,\n path: undefined,\n tags: undefined,\n };\n\n if (errorContext) {\n if (errorContext.event) {\n structuredContext.method = errorContext.event._method || undefined;\n structuredContext.path = errorContext.event._path || undefined;\n }\n\n if (Array.isArray(errorContext.tags)) {\n structuredContext.tags = errorContext.tags || undefined;\n }\n }\n\n return dropUndefinedKeys(structuredContext);\n}\n\n/**\n * Adds Sentry tracing <meta> tags to the returned html page.\n *\n * Exported only for testing\n */\nexport function addSentryTracingMetaTags(head: NuxtRenderHTMLContext['head']): void {\n const metaTags = getTraceMetaTags();\n\n if (metaTags) {\n head.push(metaTags);\n }\n}\n"],"names":["dropUndefinedKeys","getTraceMetaTags"],"mappings":";;;;;AAMA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,YAAY,EAAiC;AACjF,EAAE,MAAM,iBAAiB,GAAY;AACrC,IAAI,MAAM,EAAE,SAAS;AACrB,IAAI,IAAI,EAAE,SAAS;AACnB,IAAI,IAAI,EAAE,SAAS;AACnB,GAAG,CAAA;AACH;AACA,EAAE,IAAI,YAAY,EAAE;AACpB,IAAI,IAAI,YAAY,CAAC,KAAK,EAAE;AAC5B,MAAM,iBAAiB,CAAC,MAAA,GAAS,YAAY,CAAC,KAAK,CAAC,OAAQ,IAAG,SAAS,CAAA;AACxE,MAAM,iBAAiB,CAAC,IAAA,GAAO,YAAY,CAAC,KAAK,CAAC,KAAM,IAAG,SAAS,CAAA;AACpE,KAAI;AACJ;AACA,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;AAC1C,MAAM,iBAAiB,CAAC,IAAK,GAAE,YAAY,CAAC,IAAA,IAAQ,SAAS,CAAA;AAC7D,KAAI;AACJ,GAAE;AACF;AACA,EAAE,OAAOA,uBAAiB,CAAC,iBAAiB,CAAC,CAAA;AAC7C,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,wBAAwB,CAAC,IAAI,EAAuC;AACpF,EAAE,MAAM,QAAA,GAAWC,qBAAgB,EAAE,CAAA;AACrC;AACA,EAAE,IAAI,QAAQ,EAAE;AAChB,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AACvB,GAAE;AACF;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/runtime/utils.ts"],"sourcesContent":["import { captureException, getClient, getTraceMetaTags } from '@sentry/core';\nimport type { ClientOptions, Context } from '@sentry/types';\nimport { dropUndefinedKeys } from '@sentry/utils';\nimport type { VueOptions } from '@sentry/vue/src/types';\nimport type { CapturedErrorContext } from 'nitropack';\nimport type { NuxtRenderHTMLContext } from 'nuxt/app';\nimport type { ComponentPublicInstance } from 'vue';\n\n/**\n * Extracts the relevant context information from the error context (H3Event in Nitro Error)\n * and created a structured context object.\n */\nexport function extractErrorContext(errorContext: CapturedErrorContext): Context {\n const structuredContext: Context = {\n method: undefined,\n path: undefined,\n tags: undefined,\n };\n\n if (errorContext) {\n if (errorContext.event) {\n structuredContext.method = errorContext.event._method || undefined;\n structuredContext.path = errorContext.event._path || undefined;\n }\n\n if (Array.isArray(errorContext.tags)) {\n structuredContext.tags = errorContext.tags || undefined;\n }\n }\n\n return dropUndefinedKeys(structuredContext);\n}\n\n/**\n * Adds Sentry tracing <meta> tags to the returned html page.\n *\n * Exported only for testing\n */\nexport function addSentryTracingMetaTags(head: NuxtRenderHTMLContext['head']): void {\n const metaTags = getTraceMetaTags();\n\n if (metaTags) {\n head.push(metaTags);\n }\n}\n\n/**\n * Reports an error to Sentry. This function is similar to `attachErrorHandler` in `@sentry/vue`.\n * The Nuxt SDK does not register an error handler, but uses the Nuxt error hooks to report errors.\n *\n * We don't want to use the error handling from `@sentry/vue` as it wraps the existing error handler, which leads to a 500 error: https://github.com/getsentry/sentry-javascript/issues/12515\n */\nexport function reportNuxtError(options: {\n error: unknown;\n instance?: ComponentPublicInstance | null;\n info?: string;\n}): void {\n const { error, instance, info } = options;\n\n const metadata: Record<string, unknown> = {\n info,\n // todo: add component name and trace (like in the vue integration)\n };\n\n if (instance && instance.$props) {\n const sentryClient = getClient();\n const sentryOptions = sentryClient ? (sentryClient.getOptions() as ClientOptions & VueOptions) : null;\n\n // `attachProps` is enabled by default and props should only not be attached if explicitly disabled (see DEFAULT_CONFIG in `vueIntegration`).\n if (sentryOptions && sentryOptions.attachProps && instance.$props !== false) {\n metadata.propsData = instance.$props;\n }\n }\n\n // Capture exception in the next event loop, to make sure that all breadcrumbs are recorded in time.\n setTimeout(() => {\n captureException(error, {\n captureContext: { contexts: { nuxt: metadata } },\n mechanism: { handled: false },\n });\n });\n}\n"],"names":["dropUndefinedKeys","getTraceMetaTags","getClient","captureException"],"mappings":";;;;;AAQA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,YAAY,EAAiC;AACjF,EAAE,MAAM,iBAAiB,GAAY;AACrC,IAAI,MAAM,EAAE,SAAS;AACrB,IAAI,IAAI,EAAE,SAAS;AACnB,IAAI,IAAI,EAAE,SAAS;AACnB,GAAG,CAAA;AACH;AACA,EAAE,IAAI,YAAY,EAAE;AACpB,IAAI,IAAI,YAAY,CAAC,KAAK,EAAE;AAC5B,MAAM,iBAAiB,CAAC,MAAA,GAAS,YAAY,CAAC,KAAK,CAAC,OAAQ,IAAG,SAAS,CAAA;AACxE,MAAM,iBAAiB,CAAC,IAAA,GAAO,YAAY,CAAC,KAAK,CAAC,KAAM,IAAG,SAAS,CAAA;AACpE,KAAI;AACJ;AACA,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;AAC1C,MAAM,iBAAiB,CAAC,IAAK,GAAE,YAAY,CAAC,IAAA,IAAQ,SAAS,CAAA;AAC7D,KAAI;AACJ,GAAE;AACF;AACA,EAAE,OAAOA,uBAAiB,CAAC,iBAAiB,CAAC,CAAA;AAC7C,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,wBAAwB,CAAC,IAAI,EAAuC;AACpF,EAAE,MAAM,QAAA,GAAWC,qBAAgB,EAAE,CAAA;AACrC;AACA,EAAE,IAAI,QAAQ,EAAE;AAChB,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AACvB,GAAE;AACF,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,OAAO;;AAIvC,EAAS;AACT,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAA,EAAO,GAAE,OAAO,CAAA;AAC3C;AACA,EAAE,MAAM,QAAQ,GAA4B;AAC5C,IAAI,IAAI;AACR;AACA,GAAG,CAAA;AACH;AACA,EAAE,IAAI,QAAA,IAAY,QAAQ,CAAC,MAAM,EAAE;AACnC,IAAI,MAAM,YAAA,GAAeC,cAAS,EAAE,CAAA;AACpC,IAAI,MAAM,aAAA,GAAgB,YAAA,IAAgB,YAAY,CAAC,UAAU,EAAG,KAAiC,IAAI,CAAA;AACzG;AACA;AACA,IAAI,IAAI,aAAc,IAAG,aAAa,CAAC,WAAY,IAAG,QAAQ,CAAC,MAAO,KAAI,KAAK,EAAE;AACjF,MAAM,QAAQ,CAAC,SAAA,GAAY,QAAQ,CAAC,MAAM,CAAA;AAC1C,KAAI;AACJ,GAAE;AACF;AACA;AACA,EAAE,UAAU,CAAC,MAAM;AACnB,IAAIC,qBAAgB,CAAC,KAAK,EAAE;AAC5B,MAAM,cAAc,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAS,EAAA,EAAG;AACtD,MAAM,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO;AACnC,KAAK,CAAC,CAAA;AACN,GAAG,CAAC,CAAA;AACJ;;;;;;"}
@@ -1,6 +1,7 @@
1
1
  import { getClient } from '@sentry/core';
2
2
  import { browserTracingIntegration, vueIntegration } from '@sentry/vue';
3
3
  import { defineNuxtPlugin } from 'nuxt/app';
4
+ import { reportNuxtError } from '../utils.js';
4
5
 
5
6
  // --- Types are copied from @sentry/vue (so it does not need to be exported) ---
6
7
  // The following type is an intersection of the Route type from VueRouter v2, v3, and v4.
@@ -26,9 +27,20 @@ const sentry_client = defineNuxtPlugin({
26
27
  const sentryClient = getClient();
27
28
 
28
29
  if (sentryClient) {
29
- sentryClient.addIntegration(vueIntegration({ app: vueApp }));
30
+ // Adding the Vue integration without the Vue error handler
31
+ // Nuxt is registering their own error handler, which is unset after hydration: https://github.com/nuxt/nuxt/blob/d3fdbcaac6cf66d21e25d259390d7824696f1a87/packages/nuxt/src/app/entry.ts#L64-L73
32
+ // We don't want to wrap the existing error handler, as it leads to a 500 error: https://github.com/getsentry/sentry-javascript/issues/12515
33
+ sentryClient.addIntegration(vueIntegration({ app: vueApp, attachErrorHandler: false }));
30
34
  }
31
35
  });
36
+
37
+ nuxtApp.hook('app:error', error => {
38
+ reportNuxtError({ error });
39
+ });
40
+
41
+ nuxtApp.hook('vue:error', (error, instance, info) => {
42
+ reportNuxtError({ error, instance, info });
43
+ });
32
44
  },
33
45
  });
34
46
 
@@ -1 +1 @@
1
- {"version":3,"file":"sentry.client.js","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"sourcesContent":["import { getClient } from '@sentry/core';\nimport { browserTracingIntegration, vueIntegration } from '@sentry/vue';\nimport { defineNuxtPlugin } from 'nuxt/app';\n\n// --- Types are copied from @sentry/vue (so it does not need to be exported) ---\n// The following type is an intersection of the Route type from VueRouter v2, v3, and v4.\n// This is not great, but kinda necessary to make it work with all versions at the same time.\ntype Route = {\n /** Unparameterized URL */\n path: string;\n /**\n * Query params (keys map to null when there is no value associated, e.g. \"?foo\" and to an array when there are\n * multiple query params that have the same key, e.g. \"?foo&foo=bar\")\n */\n query: Record<string, string | null | (string | null)[]>;\n /** Route name (VueRouter provides a way to give routes individual names) */\n name?: string | symbol | null | undefined;\n /** Evaluated parameters */\n params: Record<string, string | string[]>;\n /** All the matched route objects as defined in VueRouter constructor */\n matched: { path: string }[];\n};\n\ninterface VueRouter {\n onError: (fn: (err: Error) => void) => void;\n beforeEach: (fn: (to: Route, from: Route, next?: () => void) => void) => void;\n}\n\n// Tree-shakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\nexport default defineNuxtPlugin({\n name: 'sentry-client-integrations',\n dependsOn: ['sentry-client-config'],\n async setup(nuxtApp) {\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\", in which case everything inside\n // will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n const sentryClient = getClient();\n\n if (sentryClient && '$router' in nuxtApp) {\n sentryClient.addIntegration(\n browserTracingIntegration({ router: nuxtApp.$router as VueRouter, routeLabel: 'path' }),\n );\n }\n }\n\n nuxtApp.hook('app:created', vueApp => {\n const sentryClient = getClient();\n\n if (sentryClient) {\n sentryClient.addIntegration(vueIntegration({ app: vueApp }));\n }\n });\n },\n});\n"],"names":[],"mappings":";;;;AAIA;AACA;AACA;;AAyBA,sBAAe,gBAAgB,CAAC;AAChC,EAAE,IAAI,EAAE,4BAA4B;AACpC,EAAE,SAAS,EAAE,CAAC,sBAAsB,CAAC;AACrC,EAAE,MAAM,KAAK,CAAC,OAAO,EAAE;AACvB;AACA;AACA,IAAI,IAAI,OAAO,kBAAA,KAAuB,WAAY,IAAG,kBAAkB,EAAE;AACzE,MAAM,MAAM,YAAA,GAAe,SAAS,EAAE,CAAA;AACtC;AACA,MAAM,IAAI,YAAA,IAAgB,SAAU,IAAG,OAAO,EAAE;AAChD,QAAQ,YAAY,CAAC,cAAc;AACnC,UAAU,yBAAyB,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,OAAA,GAAsB,UAAU,EAAE,MAAA,EAAQ,CAAC;AACjG,SAAS,CAAA;AACT,OAAM;AACN,KAAI;AACJ;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU;AAC1C,MAAM,MAAM,YAAA,GAAe,SAAS,EAAE,CAAA;AACtC;AACA,MAAM,IAAI,YAAY,EAAE;AACxB,QAAQ,YAAY,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,MAAA,EAAQ,CAAC,CAAC,CAAA;AACpE,OAAM;AACN,KAAK,CAAC,CAAA;AACN,GAAG;AACH,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"sentry.client.js","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"sourcesContent":["import { getClient } from '@sentry/core';\nimport { browserTracingIntegration, vueIntegration } from '@sentry/vue';\nimport { defineNuxtPlugin } from 'nuxt/app';\nimport { reportNuxtError } from '../utils';\n\n// --- Types are copied from @sentry/vue (so it does not need to be exported) ---\n// The following type is an intersection of the Route type from VueRouter v2, v3, and v4.\n// This is not great, but kinda necessary to make it work with all versions at the same time.\ntype Route = {\n /** Unparameterized URL */\n path: string;\n /**\n * Query params (keys map to null when there is no value associated, e.g. \"?foo\" and to an array when there are\n * multiple query params that have the same key, e.g. \"?foo&foo=bar\")\n */\n query: Record<string, string | null | (string | null)[]>;\n /** Route name (VueRouter provides a way to give routes individual names) */\n name?: string | symbol | null | undefined;\n /** Evaluated parameters */\n params: Record<string, string | string[]>;\n /** All the matched route objects as defined in VueRouter constructor */\n matched: { path: string }[];\n};\n\ninterface VueRouter {\n onError: (fn: (err: Error) => void) => void;\n beforeEach: (fn: (to: Route, from: Route, next?: () => void) => void) => void;\n}\n\n// Tree-shakable guard to remove all code related to tracing\ndeclare const __SENTRY_TRACING__: boolean;\n\nexport default defineNuxtPlugin({\n name: 'sentry-client-integrations',\n dependsOn: ['sentry-client-config'],\n async setup(nuxtApp) {\n // This evaluates to true unless __SENTRY_TRACING__ is text-replaced with \"false\", in which case everything inside\n // will get tree-shaken away\n if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {\n const sentryClient = getClient();\n\n if (sentryClient && '$router' in nuxtApp) {\n sentryClient.addIntegration(\n browserTracingIntegration({ router: nuxtApp.$router as VueRouter, routeLabel: 'path' }),\n );\n }\n }\n\n nuxtApp.hook('app:created', vueApp => {\n const sentryClient = getClient();\n\n if (sentryClient) {\n // Adding the Vue integration without the Vue error handler\n // Nuxt is registering their own error handler, which is unset after hydration: https://github.com/nuxt/nuxt/blob/d3fdbcaac6cf66d21e25d259390d7824696f1a87/packages/nuxt/src/app/entry.ts#L64-L73\n // We don't want to wrap the existing error handler, as it leads to a 500 error: https://github.com/getsentry/sentry-javascript/issues/12515\n sentryClient.addIntegration(vueIntegration({ app: vueApp, attachErrorHandler: false }));\n }\n });\n\n nuxtApp.hook('app:error', error => {\n reportNuxtError({ error });\n });\n\n nuxtApp.hook('vue:error', (error, instance, info) => {\n reportNuxtError({ error, instance, info });\n });\n },\n});\n"],"names":[],"mappings":";;;;;AAKA;AACA;AACA;;AAyBA,sBAAe,gBAAgB,CAAC;AAChC,EAAE,IAAI,EAAE,4BAA4B;AACpC,EAAE,SAAS,EAAE,CAAC,sBAAsB,CAAC;AACrC,EAAE,MAAM,KAAK,CAAC,OAAO,EAAE;AACvB;AACA;AACA,IAAI,IAAI,OAAO,kBAAA,KAAuB,WAAY,IAAG,kBAAkB,EAAE;AACzE,MAAM,MAAM,YAAA,GAAe,SAAS,EAAE,CAAA;AACtC;AACA,MAAM,IAAI,YAAA,IAAgB,SAAU,IAAG,OAAO,EAAE;AAChD,QAAQ,YAAY,CAAC,cAAc;AACnC,UAAU,yBAAyB,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,OAAA,GAAsB,UAAU,EAAE,MAAA,EAAQ,CAAC;AACjG,SAAS,CAAA;AACT,OAAM;AACN,KAAI;AACJ;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU;AAC1C,MAAM,MAAM,YAAA,GAAe,SAAS,EAAE,CAAA;AACtC;AACA,MAAM,IAAI,YAAY,EAAE;AACxB;AACA;AACA;AACA,QAAQ,YAAY,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAM,EAAC,CAAC,CAAC,CAAA;AAC/F,OAAM;AACN,KAAK,CAAC,CAAA;AACN;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS;AACvC,MAAM,eAAe,CAAC,EAAE,KAAA,EAAO,CAAC,CAAA;AAChC,KAAK,CAAC,CAAA;AACN;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,KAAK;AACzD,MAAM,eAAe,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAK,EAAC,CAAC,CAAA;AAChD,KAAK,CAAC,CAAA;AACN,GAAG;AACH,CAAC,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- import { getTraceMetaTags } from '@sentry/core';
1
+ import { getTraceMetaTags, getClient, captureException } from '@sentry/core';
2
2
  import { dropUndefinedKeys } from '@sentry/utils';
3
3
 
4
4
  /**
@@ -39,5 +39,40 @@ function addSentryTracingMetaTags(head) {
39
39
  }
40
40
  }
41
41
 
42
- export { addSentryTracingMetaTags, extractErrorContext };
42
+ /**
43
+ * Reports an error to Sentry. This function is similar to `attachErrorHandler` in `@sentry/vue`.
44
+ * The Nuxt SDK does not register an error handler, but uses the Nuxt error hooks to report errors.
45
+ *
46
+ * We don't want to use the error handling from `@sentry/vue` as it wraps the existing error handler, which leads to a 500 error: https://github.com/getsentry/sentry-javascript/issues/12515
47
+ */
48
+ function reportNuxtError(options
49
+
50
+ ) {
51
+ const { error, instance, info } = options;
52
+
53
+ const metadata = {
54
+ info,
55
+ // todo: add component name and trace (like in the vue integration)
56
+ };
57
+
58
+ if (instance && instance.$props) {
59
+ const sentryClient = getClient();
60
+ const sentryOptions = sentryClient ? (sentryClient.getOptions() ) : null;
61
+
62
+ // `attachProps` is enabled by default and props should only not be attached if explicitly disabled (see DEFAULT_CONFIG in `vueIntegration`).
63
+ if (sentryOptions && sentryOptions.attachProps && instance.$props !== false) {
64
+ metadata.propsData = instance.$props;
65
+ }
66
+ }
67
+
68
+ // Capture exception in the next event loop, to make sure that all breadcrumbs are recorded in time.
69
+ setTimeout(() => {
70
+ captureException(error, {
71
+ captureContext: { contexts: { nuxt: metadata } },
72
+ mechanism: { handled: false },
73
+ });
74
+ });
75
+ }
76
+
77
+ export { addSentryTracingMetaTags, extractErrorContext, reportNuxtError };
43
78
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/runtime/utils.ts"],"sourcesContent":["import { getTraceMetaTags } from '@sentry/core';\nimport type { Context } from '@sentry/types';\nimport { dropUndefinedKeys } from '@sentry/utils';\nimport type { CapturedErrorContext } from 'nitropack';\nimport type { NuxtRenderHTMLContext } from 'nuxt/app';\n\n/**\n * Extracts the relevant context information from the error context (H3Event in Nitro Error)\n * and created a structured context object.\n */\nexport function extractErrorContext(errorContext: CapturedErrorContext): Context {\n const structuredContext: Context = {\n method: undefined,\n path: undefined,\n tags: undefined,\n };\n\n if (errorContext) {\n if (errorContext.event) {\n structuredContext.method = errorContext.event._method || undefined;\n structuredContext.path = errorContext.event._path || undefined;\n }\n\n if (Array.isArray(errorContext.tags)) {\n structuredContext.tags = errorContext.tags || undefined;\n }\n }\n\n return dropUndefinedKeys(structuredContext);\n}\n\n/**\n * Adds Sentry tracing <meta> tags to the returned html page.\n *\n * Exported only for testing\n */\nexport function addSentryTracingMetaTags(head: NuxtRenderHTMLContext['head']): void {\n const metaTags = getTraceMetaTags();\n\n if (metaTags) {\n head.push(metaTags);\n }\n}\n"],"names":[],"mappings":";;;AAMA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,YAAY,EAAiC;AACjF,EAAE,MAAM,iBAAiB,GAAY;AACrC,IAAI,MAAM,EAAE,SAAS;AACrB,IAAI,IAAI,EAAE,SAAS;AACnB,IAAI,IAAI,EAAE,SAAS;AACnB,GAAG,CAAA;AACH;AACA,EAAE,IAAI,YAAY,EAAE;AACpB,IAAI,IAAI,YAAY,CAAC,KAAK,EAAE;AAC5B,MAAM,iBAAiB,CAAC,MAAA,GAAS,YAAY,CAAC,KAAK,CAAC,OAAQ,IAAG,SAAS,CAAA;AACxE,MAAM,iBAAiB,CAAC,IAAA,GAAO,YAAY,CAAC,KAAK,CAAC,KAAM,IAAG,SAAS,CAAA;AACpE,KAAI;AACJ;AACA,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;AAC1C,MAAM,iBAAiB,CAAC,IAAK,GAAE,YAAY,CAAC,IAAA,IAAQ,SAAS,CAAA;AAC7D,KAAI;AACJ,GAAE;AACF;AACA,EAAE,OAAO,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;AAC7C,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,wBAAwB,CAAC,IAAI,EAAuC;AACpF,EAAE,MAAM,QAAA,GAAW,gBAAgB,EAAE,CAAA;AACrC;AACA,EAAE,IAAI,QAAQ,EAAE;AAChB,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AACvB,GAAE;AACF;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/runtime/utils.ts"],"sourcesContent":["import { captureException, getClient, getTraceMetaTags } from '@sentry/core';\nimport type { ClientOptions, Context } from '@sentry/types';\nimport { dropUndefinedKeys } from '@sentry/utils';\nimport type { VueOptions } from '@sentry/vue/src/types';\nimport type { CapturedErrorContext } from 'nitropack';\nimport type { NuxtRenderHTMLContext } from 'nuxt/app';\nimport type { ComponentPublicInstance } from 'vue';\n\n/**\n * Extracts the relevant context information from the error context (H3Event in Nitro Error)\n * and created a structured context object.\n */\nexport function extractErrorContext(errorContext: CapturedErrorContext): Context {\n const structuredContext: Context = {\n method: undefined,\n path: undefined,\n tags: undefined,\n };\n\n if (errorContext) {\n if (errorContext.event) {\n structuredContext.method = errorContext.event._method || undefined;\n structuredContext.path = errorContext.event._path || undefined;\n }\n\n if (Array.isArray(errorContext.tags)) {\n structuredContext.tags = errorContext.tags || undefined;\n }\n }\n\n return dropUndefinedKeys(structuredContext);\n}\n\n/**\n * Adds Sentry tracing <meta> tags to the returned html page.\n *\n * Exported only for testing\n */\nexport function addSentryTracingMetaTags(head: NuxtRenderHTMLContext['head']): void {\n const metaTags = getTraceMetaTags();\n\n if (metaTags) {\n head.push(metaTags);\n }\n}\n\n/**\n * Reports an error to Sentry. This function is similar to `attachErrorHandler` in `@sentry/vue`.\n * The Nuxt SDK does not register an error handler, but uses the Nuxt error hooks to report errors.\n *\n * We don't want to use the error handling from `@sentry/vue` as it wraps the existing error handler, which leads to a 500 error: https://github.com/getsentry/sentry-javascript/issues/12515\n */\nexport function reportNuxtError(options: {\n error: unknown;\n instance?: ComponentPublicInstance | null;\n info?: string;\n}): void {\n const { error, instance, info } = options;\n\n const metadata: Record<string, unknown> = {\n info,\n // todo: add component name and trace (like in the vue integration)\n };\n\n if (instance && instance.$props) {\n const sentryClient = getClient();\n const sentryOptions = sentryClient ? (sentryClient.getOptions() as ClientOptions & VueOptions) : null;\n\n // `attachProps` is enabled by default and props should only not be attached if explicitly disabled (see DEFAULT_CONFIG in `vueIntegration`).\n if (sentryOptions && sentryOptions.attachProps && instance.$props !== false) {\n metadata.propsData = instance.$props;\n }\n }\n\n // Capture exception in the next event loop, to make sure that all breadcrumbs are recorded in time.\n setTimeout(() => {\n captureException(error, {\n captureContext: { contexts: { nuxt: metadata } },\n mechanism: { handled: false },\n });\n });\n}\n"],"names":[],"mappings":";;;AAQA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,YAAY,EAAiC;AACjF,EAAE,MAAM,iBAAiB,GAAY;AACrC,IAAI,MAAM,EAAE,SAAS;AACrB,IAAI,IAAI,EAAE,SAAS;AACnB,IAAI,IAAI,EAAE,SAAS;AACnB,GAAG,CAAA;AACH;AACA,EAAE,IAAI,YAAY,EAAE;AACpB,IAAI,IAAI,YAAY,CAAC,KAAK,EAAE;AAC5B,MAAM,iBAAiB,CAAC,MAAA,GAAS,YAAY,CAAC,KAAK,CAAC,OAAQ,IAAG,SAAS,CAAA;AACxE,MAAM,iBAAiB,CAAC,IAAA,GAAO,YAAY,CAAC,KAAK,CAAC,KAAM,IAAG,SAAS,CAAA;AACpE,KAAI;AACJ;AACA,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;AAC1C,MAAM,iBAAiB,CAAC,IAAK,GAAE,YAAY,CAAC,IAAA,IAAQ,SAAS,CAAA;AAC7D,KAAI;AACJ,GAAE;AACF;AACA,EAAE,OAAO,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;AAC7C,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,wBAAwB,CAAC,IAAI,EAAuC;AACpF,EAAE,MAAM,QAAA,GAAW,gBAAgB,EAAE,CAAA;AACrC;AACA,EAAE,IAAI,QAAQ,EAAE;AAChB,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AACvB,GAAE;AACF,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,OAAO;;AAIvC,EAAS;AACT,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAA,EAAO,GAAE,OAAO,CAAA;AAC3C;AACA,EAAE,MAAM,QAAQ,GAA4B;AAC5C,IAAI,IAAI;AACR;AACA,GAAG,CAAA;AACH;AACA,EAAE,IAAI,QAAA,IAAY,QAAQ,CAAC,MAAM,EAAE;AACnC,IAAI,MAAM,YAAA,GAAe,SAAS,EAAE,CAAA;AACpC,IAAI,MAAM,aAAA,GAAgB,YAAA,IAAgB,YAAY,CAAC,UAAU,EAAG,KAAiC,IAAI,CAAA;AACzG;AACA;AACA,IAAI,IAAI,aAAc,IAAG,aAAa,CAAC,WAAY,IAAG,QAAQ,CAAC,MAAO,KAAI,KAAK,EAAE;AACjF,MAAM,QAAQ,CAAC,SAAA,GAAY,QAAQ,CAAC,MAAM,CAAA;AAC1C,KAAI;AACJ,GAAE;AACF;AACA;AACA,EAAE,UAAU,CAAC,MAAM;AACnB,IAAI,gBAAgB,CAAC,KAAK,EAAE;AAC5B,MAAM,cAAc,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAS,EAAA,EAAG;AACtD,MAAM,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO;AACnC,KAAK,CAAC,CAAA;AACN,GAAG,CAAC,CAAA;AACJ;;;;"}
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "8.31.0",
7
+ "version": "8.32.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.1",
10
10
  "unbuild": "2.0.0"
@@ -1,6 +1,7 @@
1
1
  import { getClient } from "@sentry/core";
2
2
  import { browserTracingIntegration, vueIntegration } from "@sentry/vue";
3
3
  import { defineNuxtPlugin } from "nuxt/app";
4
+ import { reportNuxtError } from "../utils.js";
4
5
  export default defineNuxtPlugin({
5
6
  name: "sentry-client-integrations",
6
7
  dependsOn: ["sentry-client-config"],
@@ -16,8 +17,14 @@ export default defineNuxtPlugin({
16
17
  nuxtApp.hook("app:created", (vueApp) => {
17
18
  const sentryClient = getClient();
18
19
  if (sentryClient) {
19
- sentryClient.addIntegration(vueIntegration({ app: vueApp }));
20
+ sentryClient.addIntegration(vueIntegration({ app: vueApp, attachErrorHandler: false }));
20
21
  }
21
22
  });
23
+ nuxtApp.hook("app:error", (error) => {
24
+ reportNuxtError({ error });
25
+ });
26
+ nuxtApp.hook("vue:error", (error, instance, info) => {
27
+ reportNuxtError({ error, instance, info });
28
+ });
22
29
  }
23
30
  });
@@ -1,4 +1,4 @@
1
- import { getTraceMetaTags } from "@sentry/core";
1
+ import { captureException, getClient, getTraceMetaTags } from "@sentry/core";
2
2
  import { dropUndefinedKeys } from "@sentry/utils";
3
3
  export function extractErrorContext(errorContext) {
4
4
  const structuredContext = {
@@ -23,3 +23,23 @@ export function addSentryTracingMetaTags(head) {
23
23
  head.push(metaTags);
24
24
  }
25
25
  }
26
+ export function reportNuxtError(options) {
27
+ const { error, instance, info } = options;
28
+ const metadata = {
29
+ info
30
+ // todo: add component name and trace (like in the vue integration)
31
+ };
32
+ if (instance && instance.$props) {
33
+ const sentryClient = getClient();
34
+ const sentryOptions = sentryClient ? sentryClient.getOptions() : null;
35
+ if (sentryOptions && sentryOptions.attachProps && instance.$props !== false) {
36
+ metadata.propsData = instance.$props;
37
+ }
38
+ }
39
+ setTimeout(() => {
40
+ captureException(error, {
41
+ captureContext: { contexts: { nuxt: metadata } },
42
+ mechanism: { handled: false }
43
+ });
44
+ });
45
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"sentry.client.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"names":[],"mappings":";AA+BA,wBAwBG"}
1
+ {"version":3,"file":"sentry.client.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/sentry.client.ts"],"names":[],"mappings":";AAgCA,wBAmCG"}
@@ -1,6 +1,7 @@
1
1
  import type { Context } from '@sentry/types';
2
2
  import type { CapturedErrorContext } from 'nitropack';
3
3
  import type { NuxtRenderHTMLContext } from 'nuxt/app';
4
+ import type { ComponentPublicInstance } from 'vue';
4
5
  /**
5
6
  * Extracts the relevant context information from the error context (H3Event in Nitro Error)
6
7
  * and created a structured context object.
@@ -12,4 +13,15 @@ export declare function extractErrorContext(errorContext: CapturedErrorContext):
12
13
  * Exported only for testing
13
14
  */
14
15
  export declare function addSentryTracingMetaTags(head: NuxtRenderHTMLContext['head']): void;
16
+ /**
17
+ * Reports an error to Sentry. This function is similar to `attachErrorHandler` in `@sentry/vue`.
18
+ * The Nuxt SDK does not register an error handler, but uses the Nuxt error hooks to report errors.
19
+ *
20
+ * We don't want to use the error handling from `@sentry/vue` as it wraps the existing error handler, which leads to a 500 error: https://github.com/getsentry/sentry-javascript/issues/12515
21
+ */
22
+ export declare function reportNuxtError(options: {
23
+ error: unknown;
24
+ instance?: ComponentPublicInstance | null;
25
+ info?: string;
26
+ }): void;
15
27
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/runtime/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,oBAAoB,GAAG,OAAO,CAmB/E;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI,CAMlF"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/runtime/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,OAAO,EAAE,MAAM,eAAe,CAAC;AAG5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,KAAK,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,oBAAoB,GAAG,OAAO,CAmB/E;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI,CAMlF;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,IAAI,CAyBP"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/nuxt",
3
- "version": "8.31.0",
3
+ "version": "8.32.0",
4
4
  "description": "Official Sentry SDK for Nuxt (EXPERIMENTAL)",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/nuxt",
@@ -43,15 +43,15 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@nuxt/kit": "^3.12.2",
46
- "@sentry/browser": "8.31.0",
47
- "@sentry/core": "8.31.0",
48
- "@sentry/node": "8.31.0",
49
- "@sentry/opentelemetry": "8.31.0",
46
+ "@sentry/browser": "8.32.0",
47
+ "@sentry/core": "8.32.0",
48
+ "@sentry/node": "8.32.0",
49
+ "@sentry/opentelemetry": "8.32.0",
50
50
  "@sentry/rollup-plugin": "2.22.3",
51
- "@sentry/types": "8.31.0",
52
- "@sentry/utils": "8.31.0",
51
+ "@sentry/types": "8.32.0",
52
+ "@sentry/utils": "8.32.0",
53
53
  "@sentry/vite-plugin": "2.22.3",
54
- "@sentry/vue": "8.31.0"
54
+ "@sentry/vue": "8.32.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@nuxt/module-builder": "0.8.1",