Next.js Discord

Discord Forum

`@sentry/wizard` client working / server fails to send events

Unanswered
Cornish Rex posted this in #help-forum
Open in Discord
Cornish RexOP
Hello there, I've been using sentry for quite some time in production apps in my company. Lately I undertook a large refactor of one of our apps. In the process I upgraded pretty much all the core packages we use like next, sentry, react to the latest versions. I looked at all the examples that are around for configuring sentry and since I already had an existing config that was working I went from there. After I noticed that the reporting was fully gone when my upgrade was complete I went and used @sentry/wizard to check for any bits that I might have missed. With that help I managed to get client side reporting to work using the example error page provided by the wizard. Server side reporting fails on the console with a stacktrace as follows:
Error: Sentry Example API Route Error
    at handler (webpack-internal:///(api)/./src/pages/api/sentry-example-api.js:12:11)
    at /home/user/Workspace/app/node_modules/@sentry/nextjs/build/cjs/common/wrapApiHandlerWithSentry.js:90:64
    at handleCallbackErrors.handleCallbackErrors.status.status (/home/user/Workspace/app/node_modules/@sentry/core/build/cjs/tracing/trace.js:121:15)
    at Object.handleCallbackErrors (/home/user/Workspace/app/node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js:26:26)
    at /home/user/Workspace/app/node_modules/@sentry/core/build/cjs/tracing/trace.js:120:35
    at /home/user/Workspace/app/node_modules/@sentry/core/build/cjs/tracing/trace.js:445:21
    at /home/user/Workspace/app/node_modules/@sentry/core/build/cjs/tracing/trace.js:100:12
    at AsyncContextStack.withScope (/home/user/Workspace/app/node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:41:28)
    at Object.withScope (/home/user/Workspace/app/node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:127:33)
    at Object.withScope (/home/user/Workspace/app/node_modules/@sentry/core/build/cjs/currentScopes.js:55:18)
    at Object.startSpanManual (/home/user/Workspace/app/node_modules/@sentry/core/build/cjs/tracing/trace.js:96:24)
    at /home/user/Workspace/app/node_modules/@sentry/nextjs/build/cjs/common/wrapApiHandlerWithSentry.js:66:27
    at /home/user/Workspace/app/node_modules/@sentry/core/build/cjs/tracing/trace.js:199:12
    at AsyncContextStack.withScope (/home/user/Workspace/app/node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:41:28)
    at Object.withScope (/home/user/Workspace/app/node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js:127:33) {
  page: '/api/sentry-example-api'
}
  1 | // A faulty API route to test Sentry's error monitoring
  2 | export default function handler(_req, res) {
> 3 |   throw new Error("Sentry Example API Route Error");
    |         ^
  4 |   res.status(200).json({ name: "John Doe" });
  5 | }
  6 |

0 Replies