microsoft / microsoft/ApplicationInsights-JS

[BUG] AI + MSAL in SPA throws "string value is too long" exception after login.

Open
#2,167 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
685
Forks
261
Avg merge
21h 33m
Merged PRs (30d)
5

Description

**Description/Screenshot**
When logging in to a SPA / JS application with MSAL (3.0.2) it passes the "code" back in the address bar as a GET parameter. Since upgrading to 3.x branch of ApplicationInsightsJS this now throws an uncaught exception where AI can't process the request as the URL is too long and it says it is truncating this to 1024 characters.
image

I'm ok with the string being truncated but having the uncaught exception thrown after every login is a bit annoying.

**Steps to Reproduce**

- OS/Browser: Any
- SDK Version [e.g. 22]: v3.0.3
- How you initialized the SDK:

**Expected behavior**
Doesn't throw an error or allows us to configure a longer string length.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the login flow in a JavaScript SPA using MSAL 3.0.2 and Application Insights JavaScript SDK 3.0.3, then trace the handling of the returned code in the address-bar URL. Done means login no longer causes an uncaught exception when the URL is truncated, while preserving the reported telemetry behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.