question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Usage of globals breaks SSR

See original GitHub issue

Please follow the issue template below. Failure to do so will result in a delay in answering your question.

Library

  • msal@1.3.0 or @azure/msal@1.x.x
  • @azure/msal-browser@2.x.x
  • @azure/msal-angular@1.0.0-beta.5
  • @azure/msal-angular@1.x.x
  • @azure/msal-angularjs@1.x.x

Framework

Angular v9

Description

When trying to start my application with SSR and installed MSAL Library the application breaks because of the extensive direct usage of globals. It first breaks at TelemetryManager but I have seen that there are a lot of other potential unsafe usages of globals.

Security

Is this issue security related?

Regression

Did this behavior work before?

Configuration

Please provide your MSAL configuration options.

// Provide configuration values here.
// For Azure B2C issues, please include your policies.

Reproduction steps

  1. Create Angular project with SSR
  2. Install msal + msal angular
  3. Try to start SSR

Expected behavior

SSR works without errors

Browsers

Is this issue browser-specific? If so, please detail which browsers are impacted (e.g. IE 11, Safari).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
jasonnuttercommented, May 12, 2020

@DaSchTour Unfortunately, server-side rendering is currently considered out of scope for the library, given it’s heavy reliance on the browser environment, as you have noticed. This is something we may consider improving in the future, but for now, it is recommended to not include MSAL in server render paths, and only include it client-side.

1reaction
jasonnuttercommented, Sep 28, 2020

Fixed in v2 via #2073

Read more comments on GitHub >

github_iconTop Results From Across the Web

Built-in Globals and User references in a paginated report
The total number of pages relative to page breaks that reset PageNumber. If no page breaks are set, this value is the same...
Read more >
You Can Definitely Use Global Variables To Manage Global ...
Solution · Create a global state(which is technically a global variable) · Subscribe a component(s) to a created global state(this lets the global...
Read more >
Global state in SSR with Vue and Node.js - Medium
In a Node.js environment, these requests are not processed in isolated threads, but within a single thread with one global state.
Read more >
kopiro/eslint-plugin-ssr-friendly - GitHub
Disallow use of DOM globals in class constructors, as this will break SSR if you're instantiating this class as singleton or you're rendering...
Read more >
Global References in SSRS - Tutorial Gateway
The Built-in Fields Collection includes the Global references in SSRS. These are used in common report design such as: Page Numbers, Total Page...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found