microsoft / microsoft/ApplicationInsights-JS

Can we set a sessionStorage size limit so that other usages of session storage does not run in QuotaExceededError?

Open
#1,525 12 comments 0 reactions 2 assignees View on GitHub

@siyuniu-ms is already working on this.

Since Feb 22, 2024.

enhancement
Dominant language
TypeScript
Stars
685
Forks
261
Avg merge
21h 33m
Merged PRs (30d)
5

Description

**Is your feature request related to a problem? Please describe.**
- our application is using both this library and msal-browser (https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser).
- msal-browser uses session storage to store some intermediate state during its auth flow
- we see in our app, that we are running into QuotaExceededErrors
- which are thrown when we try to use session or local storage and it is already storing a lot of items

**Describe the solution you'd like**
- I like the feature that application insights js has to stored the unsent telemetry in session storage - it makes log loss less likely
- I'm not sure what to do here but it'd be nice to set a limit on the size of items being stored so we can leave some space for other usages of session storage

**Describe alternatives you've considered**
- we are thinking of just turning off the session storage usage `enableSessionStorageBuffer: false`

**Additional context**
current config
```
config: {
instrumentationKey: Environment.config.appInsightsInstrumentationKey,
endpointUrl: Environment.config.appInsightsEndpointUrl,
extensions: [this.reactPlugin],
extensionConfig: {
[this.reactPlugin.identifier]: { history }
},
disableFetchTracking: false,
disableAjaxTracking: false,
enableCorsCorrelation: true,
disableCorrelationHeaders: false,
enableAutoRouteTracking: true,
maxAjaxCallsPerView: -1,
enableResponseHeaderTracking: true,
}
```

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.