Bugsnag

How to integrate Bugsnag with Asayer and see backend errors alongside session replays.

1. Create Authorization Token

  1. Login to your Bugsnag account.
  2. Go to Settings > My account > Personal auth tokens.
  3. Click on the Generate new token + button.
  4. In the description put asayer.
  5. Click the Generate button.
  6. Copy the token then hit the Done button.

Bugsnag Personal Auth Tokens

2. Enable Bugsnag in Asayer

Put your Authorization token in Asayer dashboard under Preferences > Integrations and select the project that you want to track from the dropdown list.

Bugsnag Integration in Asayer

3. Propagate asayerSessionId

To link a Bugsnag event with the recorded user session, a unique id has to be propagated from your frontend to your backend on each request you want to track. This can be done using a custom HTTP header. In the below example, we use the fetch function to send that header.

const headers = {
Accept: 'application/json',
'Content-Type': 'application/json',
};
if (window.asayer && window.asayer.id()) {
headers['X-Session-Id'] = window.asayer.id(); // Inject asayer_session_id
}
fetch('www.your-backend.com', {
'GET',
headers,
});

In order for Asayer to associate a Bugsnag log entry with the recorded user session, a unique id has to be propagated as a meta_data > special_info to each backend error you wish to track.

Below is an example in Bugsnag's Python API.

bugsnag.notify(EXCEPTION_OBJECT, meta_data={"special_info":{"asayerSessionId": ASAYER_SESSION_ID}})

The name of the tag asayerSessionId is case sensitive.