Skip to content

Commit 8aa94a6

Browse files
committed
import from core, not node
1 parent fc62672 commit 8aa94a6

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

packages/nuxt/src/runtime/hooks/captureErrorHook.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as SentryNode from '@sentry/node';
1+
import { captureException, getClient, getCurrentScope } from '@sentry/core';
22
// eslint-disable-next-line import/no-extraneous-dependencies
33
import { H3Error } from 'h3';
44
import type { CapturedErrorContext } from 'nitropack';
@@ -8,7 +8,7 @@ import { extractErrorContext, flushIfServerless } from '../utils';
88
* Hook that can be added in a Nitro plugin. It captures an error and sends it to Sentry.
99
*/
1010
export async function sentryCaptureErrorHook(error: Error, errorContext: CapturedErrorContext): Promise<void> {
11-
const sentryClient = SentryNode.getClient();
11+
const sentryClient = getClient();
1212
const sentryClientOptions = sentryClient?.getOptions();
1313

1414
if (
@@ -33,12 +33,12 @@ export async function sentryCaptureErrorHook(error: Error, errorContext: Capture
3333
};
3434

3535
if (path) {
36-
SentryNode.getCurrentScope().setTransactionName(`${method} ${path}`);
36+
getCurrentScope().setTransactionName(`${method} ${path}`);
3737
}
3838

3939
const structuredContext = extractErrorContext(errorContext);
4040

41-
SentryNode.captureException(error, {
41+
captureException(error, {
4242
captureContext: { contexts: { nuxt: structuredContext } },
4343
mechanism: { handled: false },
4444
});

packages/nuxt/src/runtime/utils.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
logger,
99
vercelWaitUntil,
1010
} from '@sentry/core';
11-
import * as SentryNode from '@sentry/node';
1211
import type { VueOptions } from '@sentry/vue/src/types';
1312
import type { CapturedErrorContext } from 'nitropack';
1413
import type { NuxtRenderHTMLContext } from 'nuxt/app';
@@ -89,7 +88,7 @@ export function reportNuxtError(options: {
8988
}
9089

9190
async function flushWithTimeout(): Promise<void> {
92-
const sentryClient = SentryNode.getClient();
91+
const sentryClient = getClient();
9392
const isDebug = sentryClient ? sentryClient.getOptions().debug : false;
9493

9594
try {

0 commit comments

Comments
 (0)