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:
Hitting the endpoint and receiving user info works as expected when authed and unauthed
We are correctly persisting this data in Sentry store
We are correctly not re-requesting on the client if we already have this data in store
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: