microsoft / microsoft/ApplicationInsights-JS
[BUG]: snippet does not collect unhandled rejections while sdk load
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 685
- Forks
- 261
- Avg merge
- 21h 33m
- Merged PRs (30d)
- 5
Description
**Description/Screenshot**
Currently snippet collects only [unhandled errors](https://github.com/microsoft/ApplicationInsights-JS/blob/main/AISKU/snippet/snippet.js#L278) 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: `Promise.reject('foo')`
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in AISKU/snippet/snippet.js around the linked unhandled-error handling at line 278, then reproduce the issue with the provided snippet configuration and Promise.reject example. Trace how rejection tracking is initialized while the SDK loads; done means the rejection is captured and reported during that loading window, with existing behavior preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100