Open vaind opened 2 years ago
Additional off-topic TODO: warn/error out during build when "com.unity.modules.unitywebrequest": "1.0.0"
package is disabled - otherwise Unity just throws a vague error: Cannot create web request without initializing the system
that I couldn't get any useful resolution for by googling
It requires the build script to be present so sounds like a good time to do it in a single PR.
either include sentry-javascript and let it do the reporting
I think this is the preferred solution as it's our largest SDK and has a lot of development going on there.
I've tried to integrate the browser bundle.js
and it kinda works, as in the event is reported to sentry.io, however, I'm not sure how to get any stack trace info, because the scripts are loaded as blobs, which are, in case of a release build, also compressed...
Maybe we'd need to create a custom integration that does the stack parsing.
OK, so the stack traces for the embedded code coming from Unity .jslib
are pretty limited but I don't think there's much we can do, they're just not there on the error reported by the browser.
The integration could still be useful at least to get the error type/text + stack traces if they're coming from standard javascript files.
What we would need to do is:
index.html
, adding the Sentry-javascript initialization to the beginning of <head>
:
<script src="Build/bundle.js"></script>
<script>
Sentry.init({
dsn: "https://94677106febe46b88b9b9ae5efd18a00@o447951.ingest.sentry.io/5439417",
release: "0.1.0",
....
});
</script>
After the dotnet WebGL support is merged in #657, we can add support for javascript errors. There are two main approaches, the selection of the best one is part of this issue:
sentry-javascript
and let it do the reportingIn both cases, we would need to add an editor script that updates the generated JS sources (that supports both development & release builds, the latter including compression).
There's already a button to trigger a JS error - look for ThrowJavaScript(), enable it in NativeSupportScene.cs - but there would likely need to be more, e.g. to also include it in the SmokeTest.
As a related topic, we should check whether the selected approach also covers errors in the native code that are unhandled - you can reproduce those within the "Native Samples" scene in the sample repo.