replit / desktop

Replit Desktop App
114 stars 3 forks source link

Fetch / store user info for Sentry user attribution #131

Closed sergeichestakov closed 1 year ago

sergeichestakov commented 1 year ago

Why

We want user attribution in Sentry (so that we can easily link users to events which will help in searching/filtering when debugging a specific crash and generally in increasing visibility).

However, the main process does not have access to information about the user and cannot fetch it from the server as requests from that process are not authenticated. Instead, we will have to make requests from the renderer process and pass user info back and forth via IPC.

Fixes WS-1106

What changed

Fetch current user info (id, email, username) from the preload script (run in the renderer process) by hitting the /is_authenticated endpoint on the server and cache the result in our electron store. From there, we can set user info in Sentry during initialization (if we have it) and any time we receive an update (e.g. after logging in).

Test plan

Should start seeing user attribution in the desktop app Sentry! Since we don't init Sentry in dev in the meantime I tested the following:

linear[bot] commented 1 year ago

WS-1106 Set User Info in native Sentry