sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Remix backend errors captured but code is not shown (missing context-line)

Open adriwicked opened this issue 1 year ago • 6 comments

Is there an existing issue for this?

  • [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [X] I have reviewed the documentation https://docs.sentry.io/
  • [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/remix

SDK Version

7.110.1

Framework Version

Remix 7.110.1

Link to Sentry event

https://alhona.sentry.io/share/issue/e0a215fdaaf44b5bbf7bff7641264eb9/

SDK Setup

In entry.server.tsx

Sentry.init({
    environment: process.env.NODE_ENV,
    release: process.env.LAST_COMMIT_ID,
    dsn: process.env.SENTRY_DSN,
    tracesSampleRate: 1.0,
    debug: true,
  });

Steps to Reproduce

  1. Follow Manual Setup instructions to integrate Remix both in frontend and backend
  2. Generate a backend error in an action function
export async function action() {
  throw new Error("Remix BFF error");
}

Expected Result

We would like to see an Issue with the code snippet that generated the error

Actual Result

The error is captured, and the file and line that generated the error is shown but not the code snippet image

context-line is missing for the last frame image

adriwicked avatar Apr 16 '24 15:04 adriwicked

@adriwicked are you uploading source maps? https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/

AbhiPrasad avatar Apr 16 '24 15:04 AbhiPrasad

@AbhiPrasad Yes, with each release we upload the sourcemaps. We can see the errors generated in the frontend without any problem, including the code snippet.

Frontend issues includes context-line in their stack trace image

The problem only occurs in backend side (loaders and actions)

adriwicked avatar Apr 16 '24 15:04 adriwicked

So I assume this only happens for production builds, which means it's probably because we are unable to grab context when bundling.

Are you using vite? Could you share your remix backend Sentry.init call?

@onurtemizkan could you investigate further when you take a look?

AbhiPrasad avatar Apr 16 '24 16:04 AbhiPrasad

@AbhiPrasad yeah, that's right. It only happens for production builds.

No, we are not using vite. Here you have our Sentry.init call:

Sentry.init({
  environment: process.env.NODE_ENV,
  release: process.env.LAST_COMMIT_ID,
  dsn: process.env.SENTRY_DSN,
  tracesSampleRate: 1.0,
  debug: true,
});

adriwicked avatar Apr 16 '24 21:04 adriwicked

Any news on this? I have the same problem

NachoLZ avatar Oct 17 '24 08:10 NachoLZ

@NachoLZ are you able to provide a reproduction with a simple remix app @NachoLZ? That will help us debug further.

AbhiPrasad avatar Oct 17 '24 13:10 AbhiPrasad

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar Nov 23 '24 08:11 getsantry[bot]