Repository navigation
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
- StatusShow more project fieldsNo status
Activity
linear commentedon Sep 10, 2025
WIZARD-100 Inaccurate Error reporting in Cloudflare Workers
linear commentedon Sep 10, 2025
JS-922 Inaccurate Error reporting in Cloudflare Workers
s1gr1d commentedon Sep 10, 2025
Hello, I transferred your issue to the
sentry-javascriptrepository.Thanks for the reproduction! I'm gonna take a look at this.
fix(nitro): Support nested `_platform` properties in Nitro 2.11.7+ (#…
s1gr1d commentedon Sep 11, 2025
I could not exactly reproduce the actual/expected examples you described but it seems like the error was not captured with the Sentry Nitro plugin cause the object is now nested in
_platform.This PR will fix this: #17596
I'm gonna close the issue. If you are still experiencing problems after this released, we'll reopen the issue.
But in general: you don't need to use
autoInjectServerSentry, just thesentryCloudflareNitroPluginwithout asentry.server.config.tsfile.Buzut commentedon Sep 11, 2025
Thank you for taking care of the issue in such a timely fashion. I'll give it a new try as soon as the #17596 PR is released.
I'll record a detailed video if needed in case I'm still experiencing issues.
docs(nuxt): Update docs for Cloudflare Workers (#14889)
github-actions commentedon Sep 16, 2025
A PR closing this issue has just been released 🚀
This issue was referenced by PR #17596, which was included in the 10.12.0 release.