Skip to content

Better stacktrace data for non-file routes behind login wall #8656

@cstavitsky

Description

@cstavitsky

Submitting on behalf of a customer (see linked Jira ticket for customer-specific details):

Problem Statement

In some cases of the same issue, stack traces have rich context, but in other cases, there is no context. The pages in question involve HAML

Example A (already behaves how we want)

URL: http://some-client.myexamplesite.com/admin:

Screenshot 2023-07-25 at 11 12 11 AM

When we visit the actual URL and look at the page source, we can see that line 289 is present and matches the source context shown in Sentry:

Screenshot 2023-07-26 at 9 16 37 AM

Great -- this is what we want.

Example B (want different behavior)

URL: http://another-client.myexamplesite.com/admin:

Screenshot 2023-07-25 at 11 11 32 AM

When we visit the actual URL and look at the page source, we see that line 407, where the error occurred, does not exist:

Screenshot 2023-07-26 at 9 16 48 AM

The desired behavior is to have similar detailed source context even for errors behind login walls.

Why this happens

I and colleague @Prithvirajkumar spoke internally to @kamilogorek on Slack, who mentioned that the problem with the missing stack trace is that the captured error is pointing to a route, in the case of the example it’s /admin.

  • The problem is that the captured error is pointing to a route, in this case it's /admin.
  • There’s no such artifact, as it’s not a file, so we reach out to scrape the page.
  • We do so successfully for pages that have no login wall (if we view the page source in our browser without logging in, we see the line where the error was triggered)
  • Whereas, for events with no context, it’s getting a “login” page served, effectively not being able to resolve it (if we visit the page source in our browser without logging in, the line number where the error occurred does not exist, indicating that it took place behind a login wall)

Solution Brainstorm

Our customer writes:

Because our haml sections are legacy code they're also more prone to errors, so being able to pinpoint the code is pretty important for us. Unfortunately the majority of our important errors happen while users are logged in.
Because Bugsnag does provide context for these same errors, it looks like there's room for improvement. They must be capturing that context as the event happens and sending it along with the initial payload. I'm going to look at doing the same and capture/send it as metadata, but that won't show up as a stack trace. Can I make a feature request for parity with Bugsnag here?

I've confirmed that Bugsnag sends this helpful data with the event. Here's a screenshot for reference

Screenshot 2023-07-24 at 11 14 32 AM

The customer also provided this screenshot from Bugsnag:

Screenshot 2023-07-25 at 3 39 09 PM

The ideal situation would be to have stack trace information shown even for errors occurring behind login-walled routes, such as /admin in the example.

This could require capturing and including stacktrace data at the time of the crash rather than scraping the page and encountering the login wall.

Product Area

Issues

┆Issue is synchronized with this Jira Improvement by Unito

Metadata

Metadata

Assignees

Labels

Package: browserIssues related to the Sentry Browser SDKSync: Jiraapply to auto-create a Jira shadow ticket

Type

No type

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions