Issue
I saw that it is possible to capture replays for backend errors. How can I set it up?
Applies To
- All SaaS Customers
- Session Replay
Resolution
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.
Below is a step-by-step guide on how to set up Session Replay for your backend errors:
- Ensure that you are using the up-to-date version of your chosen Sentry backend SDK. If it is not possible to upgrade right now, please make sure you are at least on the minimum supported version.
- If you are have set up one of our frontend SDKs for your frontend (recommended), you can set up Session Replay normally. Skip to step 5.
- Alternatively, you can use our JS loader at the top of your page. The first thing you would need to check is the properties of the DSN key that you are using for the JS loader script. Please follow the steps below:
- Go to the project's settings in Sentry > Client Keys (DSN)
- Find the DSN key you are using in the loader script and click "Configure"
- Make sure that the key's "Use Case" is "user". If it is not, you will need to use another DSN key, or create a new one ("Generate New Key").
- On the key's "javascript loader script" section, make sure that the SDK's version is 7.x, and that "Enable Session Replay" is toggled on.
- For Session Replay, the defaults are
replaysSessionSampleRate: 0.1
andreplaysOnErrorSampleRate: 1
. This means Replays will be captured for 10% of all normal sessions and for all sessions with an error. Keep in mind thatreplaysOnErrorSampleRate
will be triggered only by frontend errors, so you might need to also set up the custom configuration as documented here in order to change your sample rates. Please note that in this case you will need to use the replay configuration documented here. - Enable tracing for both you backend and your frontend SDK. You can find the corresponding option for the SDK of your choice here.
For more information, please see the following articles: