-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Environment
Using Nuxt and Cloudflare Workers (not sure if it's at the Nuxt, Nitro or V8 level).
Steps to Reproduce
I set up a repo with the latest versions of Nuxt, Wrangler and Sentry SDK to easily reproduce.
- main branch shows how error are reported in Worker environment
- baseline branch shows the basic node setup with proper error reporting and stack traces
I'm not sure about the Cloudflare specific configuration as the docs mention the old Cloudflare Pages product, not Workers.
For that reason, I left in the repo both the /server/plugins/sentry-cloudflare-plugin.ts
and sentry.server.config.ts
although it is mentioned to have either one at a time (easy to delete for testing).
It's also worth mentioning that I tried both normal and the limited (top-level-import
) methods.
Expected Result
Error: Nuxt Server Error 4
Issue ID: 6869389825
Project: sentry-test
Date: 10/09/2025, 15:13:58
Tags
- browser: Chrome 138.0.0
- browser.name: Chrome
- client_os: macOS
- client_os.name: macOS
- environment: production
- handled: no
- level: error
- mechanism: generic
- os: macOS 14.7.6
- os.name: macOS
- release: 3bffb684f168a67f1d50a894681f4020087b9779
- runtime: node v24.4.1
- runtime.name: node
- server_name: MacBook-Air.local
- transaction: GET /api/error
- url: http://localhost:3000/api/error
Exception
Exception 1
Type: Error
Value: Nuxt Server Error
Stacktrace
createError$1 in /Users/buzut/Downloads/sentry-nuxt/.output/server/chunks/nitro/nitro.mjs [Line 978] (In app)
return obj;
}
}
function createError$1(input) {
if (typeof input === "string") {
return new H3Error(input); <-- SUSPECT LINE
}
if (isError(input)) {
return input;
}
const err = new H3Error(input.message ?? input.statusMessage ?? "", {
error in ./server/api/error.js [Line 2] (In app)
export default eventHandler((event) => {
throw createError('Nuxt Server Error'); <-- SUSPECT LINE
});
Unknown function in /Users/buzut/Downloads/sentry-nuxt/.output/server/chunks/nitro/nitro.mjs [Line 1852] (In app)
};
const handler = eventHandler((event) => {
if (_resolved) {
return _resolved.handler(event);
}
return resolveHandler().then((r) => r.handler(event)); <-- SUSPECT LINE
});
handler.__resolve__ = resolveHandler;
return handler;
}
const lazyEventHandler = defineLazyEventHandler;
Object.? in /Users/buzut/Downloads/sentry-nuxt/.output/server/chunks/nitro/nitro.mjs [Line 1921] (In app)
if (layer.match && !layer.match(_layerPath, event)) {
continue;
}
event._path = _layerPath;
event.node.req.url = _layerPath;
const val = await layer.handler(event); <-- SUSPECT LINE
const _body = val === void 0 ? void 0 : await val;
if (_body !== void 0) {
const _response = { body: _body };
if (options.onBeforeResponse) {
event._onBeforeResponseCalled = true;
Unknown function in /Users/buzut/Downloads/sentry-nuxt/.output/server/chunks/nitro/nitro.mjs [Line 4544] (In app)
debug$1.log(
`Patched h3 event handler. ${isolationScope === newIsolationScope ? "Using existing" : "Created new"} isolation scope.`
);
return withIsolationScope(newIsolationScope, async () => {
try {
return await handlerTarget.apply(handlerThisArg, handlerArgs); <-- SUSPECT LINE
} finally {
await flushIfServerless();
}
});
}
Server.toNodeHandle in /Users/buzut/Downloads/sentry-nuxt/.output/server/chunks/nitro/nitro.mjs [Line 2192] (In app)
}
function toNodeListener(app) {
const toNodeHandle = async function(req, res) {
const event = createEvent(req, res);
try {
await app.handler(event); <-- SUSPECT LINE
} catch (_error) {
const error = createError$1(_error);
if (!isError(_error)) {
error.unhandled = true;
}
What you thought would happen.
Actual Result
FetchError: [GET] "/api/error": 500 Server Error
Issue ID: 6869165189
Project: sentry-test
Date: 10/09/2025, 15:33:04
Tags
- browser: Chrome 138.0.0
- browser.name: Chrome
- device: Mac
- device.family: Mac
- environment: production
- handled: no
- level: error
- mechanism: auto.browser.global_handlers.onunhandledrejection
- os: Mac OS X >=10.15.7
- os.name: Mac OS X
- release: 3bffb684f168a67f1d50a894681f4020087b9779
- transaction: /
- url: http://localhost:8787/
Exception
Exception 1
Type: FetchError
Value: [GET] "/api/error": 500 Server Error
Stacktrace
$fetchRaw in ./node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs [Line 311] (Not in app)
await callHooks(
context,
context.options.onResponseError
);
}
return await onError(context); <-- SUSPECT LINE
}
return context.response;
};
const $fetch = async function $fetch2(request, options) {
const r = await $fetchRaw(request, options);
$fetch in ./node_modules/ofetch/dist/shared/ofetch.03887fc3.mjs [Line 316] (Not in app)
return await onError(context);
}
return context.response;
};
const $fetch = async function $fetch2(request, options) {
const r = await $fetchRaw(request, options); <-- SUSPECT LINE
return r._data;
};
$fetch.raw = $fetchRaw;
$fetch.native = (...args) => fetch(...args);
$fetch.create = (defaultOptions = {}, customGlobalOptions = {}) => createFetch({
Note that the behaviour is the same if using the local WorkerD server or a real deployment on Cloudflare servers.
Metadata
Metadata
Assignees
Labels
Projects
Status