Skip to content

Stack trace not working for Next.js api routes on Vercel when using pages router #14166

Open

Description

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

8.36.0

Framework Version

15.0.2

Link to Sentry event

https://branislavbrincko.sentry.io/issues/6041545514/?project=4508239106146304&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&statsPeriod=14d&stream_index=1

Reproduction Example/SDK Setup

https://github.com/branislavbrincko/sentry-nextjs-traces-bug

Steps to Reproduce

  1. create a new Next.js project using npx create-next-app@latest (select pages router during setup)
  2. setup Sentry using npx @sentry/wizard@latest -i nextjs
  3. deploy project to Vercel
  4. navigate to /sentry-example-page and click on Throw error! button

Expected Result

I expect to see a proper stack trace for error thrown in API route handler (by proper stack trace I mean I expect to see this throw new Error("Sentry Example API Route Error"); line). The following is the stack trace I get when I run the project locally in dev and this is what I expect also for prod on Vercel:

Image

Actual Result

Instead, the last trace is sentry-wrapper-module:

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

Projects

  • Status

    Waiting for: Community

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions