Closed
Description
Environment
How do you use Sentry?
Sentry SaaS (sentry.io) or self-hosted/on-premise (which version?)
We use Sentry SaaS.
Which version of the SDK?
2.4.0
How did you install the package? (Git-URL, Assetstore)
Git-URL
Which version of Unity?
2022.3.37f1
Is this happening in Unity (editor) or on a player like Android, iOS, Windows?
Android, iOS
Steps to Reproduce
- Create a new
SentryOptionsConfigurationObject
via the Sentry SDK UI (this replaces the Build/Run time configuration objects) - This object sets the
Environment
field topd_dev
orpd_prod
depending on the context of the build. We do not use the wordproduction
which is Sentry's default bucket if we left this blank. - This object also logs what environment it's in via a
Debug.Log
eg:"Hello I am in the [dev] environment"
- Add a button in a scene that runs
Debug.LogError("Hello, i am error!")
- Add a button in the scene that runs
UnityEngine.Diagnostics.Utils.ForceCrash(ForcedCrashCategory.Abort)
(this will force the app to crash) - Build the game for iOS or Android.
- Run the game on device, press each button
Expected Result
At build-time:
- I see the message telling me what environment I'm in. (eg: "Hello I am the [prod] environment")
At runtime, on device:
- I see the same log message (I'm using SRDebugger to see my console logs on-device).
- Any Debug.LogError, Exception, or Crash should show up under the
pd_prod
/pd_dev
environment.
Actual Result
At build-time:
- ✅ I see the message telling me what environment I'm in. (eg: "Hello I am the [prod] environment")
At runtime, on device:
- 🟨 I do not see the log messages telling me what environment I'm in. Implying the
SentryOptionsConfigurationObject
did not execute at runtime. - ✅ When the app crashes: The correct thing happens, the crash report shows up under the
pd_dev
/pd_prod
environment corresponding to how the project was built. - 🔴 When the app errors (either by throwing an exception or by
Debug.LogError
) the log message shows up inproduction
-- as if I didn't set an environment at all!
Known workaround
I've found as a workaround I can setup a Scope
with the environment and that behaves as expected. However, I can't setup the scope right away, so some errors are still leaking into production
. When errors leak into production
I can't tell if they were from prod or dev.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done
Status
No status