Sentry

Integrating LogRocket with Sentry

Add a LogRocket session recording URL to every Sentry exception report.

Sentry.configureScope(scope => {
  scope.setExtra("sessionURL", LogRocket.sessionURL);
});

LogRocket.sessionURL returns null in cases where the LogRocket SDK hasn't fully initialized and begun sending session data back to LogRocket servers. To guarantee the presence of a session URL, pass a callback to LogRocket.getSessionURL().

LogRocket.getSessionURL(sessionURL => {
  Sentry.configureScope(scope => {
    scope.setExtra("sessionURL", sessionURL);
  });
});

To pass the session URL with a timestamp to the moment that an error is caught by Sentry, the LogRocket URL can be included in Sentry's beforeSend() action

Sentry.init({
  beforeSend(event) {
    const logRocketSession = LogRocket.sessionURL;
    if (logRocketSession !== null) {
      event.extra["LogRocket"] = logRocketSession;
      return event;
    } else {
      return event;
    }
  },
});

If you're using the legacy Raven SDK:

Raven.setDataCallback(data => {
  data.extra.sessionURL = LogRocket.sessionURL;
  return data;
});

Updated 4 months ago

Sentry


Integrating LogRocket with Sentry

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.