Back to Blog Home

Replaying Backend Errors using Sentry’s Session Replay

Josh Ferge image

Josh Ferge -

Replaying Backend Errors using Sentry’s Session Replay

With Session Replay tools, you can more easily see what user actions lead to an error. For example, Sentry’s Session Replay is a first class integration with frontend errors that handles this case beautifully.

Session Replay records the web browser, which will only show issues if they happen on the user’s webpage browsing session. As a backend developer, I thought it was a great feature, although I didn’t get to use it much. Most of my Sentry Issues and stack traces occur on the backend, which replays don’t observe.

But then we shipped Backend Error linking, which allows the frontend session recordings to link to your backend errors.This works via integrating replays with our tracing data model so that when you have Sentry wired up on your frontend and backend, we have data connectivity end to end on your APIs, and can link replays to backend endpoints.

How to Use Session Replay to Identify Backend Errors

To get started, make sure you’re on the minimum SDK depending on which projects you’ve installed:

  • JavaScript (or related framework) 7.51.0
  • Python 1.20.0
  • Node 7.48.0
  • PHP 3.18.0
  • NET 3.31.0
  • Java 6.17.0
  • Ruby 5.9.0
  • Go 0.21.0

Set Up Session Replay and set your trace propagation.

Sentry.init({
  tracePropagationTargets: ["third-party-site.com", /^https:\/\/yourserver\.io\/api/],
});

Session Replay in Action

At Sentry, we have a React frontend, and Django backend. On our Django backend, there was a pesky Google Cloud Platform permissions issue we saw infrequently. We had it deep within our backlog, unsure if users were actually affected by it.

Default Credentials Error

After we released the Replay <> Backend Error linking feature, I noticed that there was now a replay associated with the issue.

Default Credentials Error Replay Button

I clicked the play button, and drilled into the replay. It took me right to the timestamp where the error occurred, and I can see an accompanying JS error along with it.

Default Credentials Error Replay Timeline

Watching the session replay, I see the user get super confused right at that point, jiggle their mouse around, and refresh the page. I empathize with the user here, confirm that it leads to a bad experience, I know to prioritize this error higher up in my triage list, and fix this bad experience.

As a backend engineer, there are instances where certain anomalies may seem peculiar, yet we might choose to sideline them temporarily. However, with tools like error monitoring and Session Replay, we’re able to gain more intimate insight into our users’ experiences, which significantly accelerates our capacity to identify, prioritize, and address issues.

Check out the original thread this blog post was based on.

How to Get Started with Session Replay

Session Replay is available on all web-based platforms, with a base allotment of replays included in every plan. If you are using Session Replay for the first time, add @sentry/replay to your existing Sentry browser JavaScript config to start seeing Replays.

Interested in learning more or have product feedback? Drop us a line on GitHub, Twitter, or Discord (#session-replay channel). And, if you’re new to Sentry, you can try it for free or request a demo to get started.

Share

Share on Twitter
Share on Facebook
Share on HackerNews
Share on LinkedIn

Published

Sentry Sign Up CTA

Code breaks, fix it faster

Sign up for Sentry and monitor your application in minutes.

Try Sentry Free

Topics

Dogfooding Chronicles

The best way to debug slow web pages

Listen to the Syntax Podcast

Of course we sponsor a developer podcast. Check it out on your favorite listening platform.

Listen To Syntax
    TwitterGitHubDribbbleLinkedinDiscord
© 2024 • Sentry is a registered Trademark
of Functional Software, Inc.