getsentry/sentry-dotnet

Session Replays Not Working for Front End Errors in AspNetCore

Closed this issue · 7 comments

Package

Sentry

.NET Flavor

.NET

.NET Version

8

OS

Windows

SDK Version

newest

Self-Hosted Sentry Version

No response

Steps to Reproduce

Create a new project in with visual studio as an AspNetCore Web App (Model-View-Controller):
image

Should have the following folder structure:
image

Create new project in Sentry with browser javascript:

image

Add the following line of code to the header in the Views/Home/Shared/_Layout.cshtml file with the correct dsn number for that project:
image

Add the following line of code to the Views/Home/Privacy.cshtml file to trigger an error that is sent to sentry:
image

Run the solution and click on the Privacy tab at the top and the error will be triggered and sent to the Sentry project:
image

Expected Result

Since session replays are on by default with the loader script:

https://docs.sentry.io/platforms/javascript/install/loader/

This should trigger an Error with a session replay as we threw an error in the <script> tag and you will see this in the sentry project. However, this will not show up in the session replays for that specific error. Since the default is at session replays will trigger after every error it should show up in that issue:

image

After running it a few times however I do see a session replay in the normal replays but do not see any issues attached to that session replay.

Actual Result

Should be seeing it in this tab of the issue since it is an error but I do not:

image

Hey @karl-gardner, thanks for reaching out. Could you confirm that there's no adblock or somesuch blocking the SDK?
I followed your repro and errors do show up as expected.
Screenshot 2024-06-17 at 19 39 07

Hello @bitsandfoxes ,

Exactly! The error is showing up for me as well:

image

However, their are no session replays attached to this error:

image

Thanks,

Karl

Ah, gotcha.
After playing around with it for a bit I think this looks like a current limitation of the loader script. I've forwarded the issue internally. It seems like the script is executing too early for the replay integration to kick in. You can modify the SDK's capabilities to include logging via Project Settings -> DSN on Sentry.
What I tested and what works right now is delaying the error (i.e. putting it inside a button <button onclick="throw new Error('Sentry Test Error')"></button>)

Hello @bitsandfoxes,

So, this would be a bug and it's on the queue to be fixed? or should I look into the directions that you say to do to try to get it working?

Thanks,

Karl

Maybe @lforst can chime in here to see whether this is a limitation or a bug.

Thanks for looking into this @bitsandfoxes and @lforst