I want to use Sentry in a Blazor WebAssembly (WASM) App. When I try to capture an exception with: SentrySdk.CaptureException(new Exception("foo"));
i get a CORS error:
Quellübergreifende (Cross-Origin) Anfrage blockiert: Die Gleiche-Quelle-Regel verbietet das Lesen der externen Ressource auf https://sentry.io/api/<...>/store/. (Grund: CORS-Preflight-Antwort schlug fehl).
Quellübergreifende (Cross-Origin) Anfrage blockiert: Die Gleiche-Quelle-Regel verbietet das Lesen der externen Ressource auf https://sentry.io/api/<...>/store/. (Grund: CORS-Anschlag schlug fehl).
For the OPTIONS Request sent to the server the headers are as follows:
Hello,
Thank you for you using Sentry and filing an issue.
I have had a look at the CORS problem and it seems to be on our side.
I am working on a fix right now and I expect it to be live by the end of the day.
I will post another message when it is.
And thanks @QFood for trying the .NET SDK with Blazor web assembly. I’ve been wanting to take a look at that for a while now. Last I tried wasm didn’t have ‘threads’ but since then Mono already mapped Task.Run to the new threading so it should work now submitting events in the background.
Perhaps .NET 5 will release a stable version of Blazor wasm already.
My goal is to log unhandled exceptions to Sentry. Currently (Blazor WASM preview 2) it is not possible as Blazor uses Console.WriteLine to display exceptions to the developer. This will be changed in Preview 3 to use an ILogger which can be plugged in by the developer.