microsoft / microsoft/ApplicationInsights-JS

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

Open
#2,203 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement snippet
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.