Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry doesn't respect next.js basePath config when resolving stack frames #9057

Closed
3 tasks done
simon-abbott opened this issue Sep 19, 2023 · 6 comments · Fixed by #9457
Closed
3 tasks done

Sentry doesn't respect next.js basePath config when resolving stack frames #9057

simon-abbott opened this issue Sep 19, 2023 · 6 comments · Fixed by #9457
Assignees
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Bug

Comments

@simon-abbott
Copy link

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

7.69.0

Framework Version

13.4.4

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

  1. In next.config.js set basePath: '/some/path', and use withSentryConfig as normal
  2. Trigger some client-side error in dev mode

Expected Result

The error metadata should be fetched correctly.

Actual Result

Sentry tries to fetch /__nextjs_original-stack-frame instead of /some/path/__nextjs_original-stack-frame, causing a 404 error.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Sep 19, 2023
@github-actions github-actions bot added the Package: nextjs Issues related to the Sentry Nextjs SDK label Sep 19, 2023
@simon-abbott
Copy link
Author

I've traced the issue to this fetch:

const res = await fetch(
`${
// eslint-disable-next-line no-restricted-globals
typeof window === 'undefined' ? 'http://localhost:3000' : '' // TODO: handle the case where users define a different port
}/__nextjs_original-stack-frame?${params.toString()}`,

@AbhiPrasad
Copy link
Member

Does this error happen when you build the app for production?

@simon-abbott
Copy link
Author

No, it does not. In fact, no call to __nextjs_original-stack-frame is made at all. But that doesn't surprise me seeing as the relevant code I found is in a file called devErrorSymbolicationEventProcessor.ts

@Lms24
Copy link
Member

Lms24 commented Oct 2, 2023

Thanks for investigating! Would you be interested in opening a PR, given that you already took the time to debug where this happens? If not, no worries. We'll backlog it and fix it (can't give you an ETA, though).

@simon-abbott
Copy link
Author

If I find some time to make a PR, sure, but I am unfortunately very busy and this is quite low on my list at the moment (we usually have Sentry disabled during development and only use enable it to test that it's working at all, so it doesn't usually affect us).

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Oct 2, 2023
@Lms24
Copy link
Member

Lms24 commented Oct 2, 2023

I see, no problem! Backlogging for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants