Skip to content

Commit b1f2cae

Browse files
cursoragentclaude
andcommitted
fix(nuxt): remove duplicate legacy handler patch
Co-Authored-By: gpt-5.3-codex-high <noreply@anthropic.com>
1 parent 9c9528e commit b1f2cae

File tree

1 file changed

+2
-33
lines changed

1 file changed

+2
-33
lines changed
Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
1-
import {
2-
debug,
3-
flushIfServerless,
4-
getDefaultIsolationScope,
5-
getIsolationScope,
6-
withIsolationScope,
7-
} from '@sentry/core';
8-
import type { EventHandler, H3Event } from 'h3';
1+
import { debug } from '@sentry/core';
2+
import type { H3Event } from 'h3';
93
import type { NitroAppPlugin } from 'nitropack';
104
import type { NuxtRenderHTMLContext } from 'nuxt/app';
115
import { sentryCaptureErrorHook } from '../hooks/captureErrorHook';
126
import { updateRouteBeforeResponse } from '../hooks/updateRouteBeforeResponse';
137
import { addSentryTracingMetaTags } from '../utils';
148

159
export default (nitroApp => {
16-
nitroApp.h3App.handler = patchEventHandler(nitroApp.h3App.handler);
17-
1810
nitroApp.hooks.hook('beforeResponse', updateRouteBeforeResponse);
1911

2012
nitroApp.hooks.hook('error', sentryCaptureErrorHook);
@@ -37,26 +29,3 @@ export default (nitroApp => {
3729
}
3830
});
3931
}) satisfies NitroAppPlugin;
40-
41-
function patchEventHandler(handler: EventHandler): EventHandler {
42-
return new Proxy(handler, {
43-
async apply(handlerTarget, handlerThisArg, handlerArgs: Parameters<EventHandler>) {
44-
const isolationScope = getIsolationScope();
45-
const newIsolationScope = isolationScope === getDefaultIsolationScope() ? isolationScope.clone() : isolationScope;
46-
47-
debug.log(
48-
`Patched h3 event handler. ${
49-
isolationScope === newIsolationScope ? 'Using existing' : 'Created new'
50-
} isolation scope.`,
51-
);
52-
53-
return withIsolationScope(newIsolationScope, async () => {
54-
try {
55-
return await handlerTarget.apply(handlerThisArg, handlerArgs);
56-
} finally {
57-
await flushIfServerless();
58-
}
59-
});
60-
},
61-
});
62-
}

0 commit comments

Comments
 (0)