Server side stack traces for Next.js / Typescript on Vercel

Hi everyone. I have tried everything in the world to get my non minified stack traces of my nextjs application running on Vercel.

Here is the super simple repo I am deploying, so you can look at all the details by yourself:

Today, I do get unminified stack traces when I run it:

  • locally with bun (bun run build && bun run start)
  • On netlfify, with upload of the source maps to Sentry.
  • Locally with upload of source map to Sentry

My endpoint is dead simple:

// app/api/error/route.ts

export const runtime = "nodejs";

export async function GET(request: Request) {
  throw new Error("Test errorr");
}

When running on Vercel, with the exact same Sentry setup, I get some stack trace all about Sentry, but nothing about my endoint:
```

Error: Test errorr
    at a.modules (nextjs-test/sentry-wrapper-module:13:29)
    at l (nextjs-test/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js:60:1)
    at b.handleCallbackErrors (nextjs-test/./node_modules/@sentry/core/build/cjs/utils/handleCallbackErrors.js:29:1)
    at <anonymous> (nextjs-test/./node_modules/@sentry/nextjs/build/cjs/common/wrapRouteHandlerWithSentry.js:59:1)
    at <anonymous> (nextjs-test/./node_modules/@sentry/opentelemetry/build/cjs/index.js?79d2:1308:1)
    at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14)
    at g.with (nextjs-test/./node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js?de7f:33:1)
    at b.with (nextjs-test/./node_modules/@sentry/opentelemetry/build/cjs/index.js?79d2:1433:1)
    at a.prototype.with (nextjs-test/./node_modules/@opentelemetry/api/build/esm/api/context.js?ad77:88:1)
    at <object>.withScope (nextjs-test/./node_modules/@sentry/opentelemetry/build/cjs/index.js?79d2:1307:1)
```

When running on Netlify (exact same code, exact same Sentry related var env), I get that:

How can I get interesting stack traces for my typescript / nextjs application when running on Vercel (backend code only, I don’t care about front end code for this conversation).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.