Release tracking on the client

I’ve managed to add the current git commit hash as an environment variable on the server and pass that as release to Sentry.init.

But how should I set this up on the client? In order to get that hash on the client I need to load it via my API, meaning it won’t be available yet when I call Sentry.init.

Is it possible to set a release when you call Sentry.withScope and Sentry.captureException instead? How would I do that?

The only other option I can think of is to make sure the hash is always loaded first and then set it as a global window variable to ensure it can be used in Sentry.init, but that seems a bit hacky and prone to failure…

What I ended up doing is move the Sentry init call to my global App component (inside componentDidMount), since that component does receive the necessary data. So far there doesn’t seem to be any downsides, but I’ll update this thread if it turns out to be a bad idea.