Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: snippet does not collect unhandled rejections while sdk load #2203

Open
VitaliyPotapov opened this issue Nov 21, 2023 · 1 comment
Open
Labels
enhancement snippet Snippet update required or suggested

Comments

@VitaliyPotapov
Copy link

Description/Screenshot
Currently snippet collects only unhandled errors but not unhandled rejections while sdk load. This can lead to missing rejections in analytic logs.

Steps to Reproduce

  1. Setup snippet with config:
    disableExceptionTracking: false,
    enableUnhandledPromiseRejectionTracking: true,
    
  2. Add unhandled rejection in subsequent script: <script>Promise.reject('foo')</script>
  3. Open page
  • OS/Browser: osx, chrome
  • SDK Version [e.g. 22]: "@microsoft/applicationinsights-web": "^3.0.3",
  • How you initialized the SDK: snippet

Expected behavior
Unhandled rejection captured and reported.

@MSNev
Copy link
Collaborator

MSNev commented Dec 4, 2023

Interesting, this is a good observation. Most people probably have not identified this because of the small window of time between when the snippet runs and drops the SDK script tag on the page and when it's loaded. By default the SDK (should) be loaded before the page becomes interactive.

Historically, this also use to "delay" the execution of other scripts (so this situation never occurred), however, this is no longer true with modern browsers so other scripts may cause fail cause unhandled rejections.

Tagged as an enhancement for the snippet.

The downside is the additional code that will be required to be included in the snippet.

@MSNev MSNev added the snippet Snippet update required or suggested label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement snippet Snippet update required or suggested
Projects
None yet
Development

No branches or pull requests

2 participants