Skip to content

Conversation

mattiaslvv
Copy link

@mattiaslvv mattiaslvv commented Sep 17, 2025

There is an issue with the SSE-connection logic.
A check exists if (url !== this.endpoint) { return next() } where this.endpoint default starts with a /, example /@angular-architects/native-federation:build-notifications and the incoming url variable gets stripped to being without a leading /. Therefore, it always goes into the above if-clause, resulting in setupSSEConnection being unreachable, ultimately never setting up an SSE build-notification connection properly.

This fix checks if this.endpoint has a leading /, if so it adds a leading / onto the url variable for proper comparison.

@Aukevanoost
Copy link

Aukevanoost commented Oct 2, 2025

Hi @mattiaslvv,

I tried to reproduce the issue but I currently was unable to. Do you happen to have a particular setup where the issue occurs?

With a normal Angular monorepo with a host and mfe, the error does not seem to occur (at the mfe logs).

-------------------------------------------------
before: /@angular-architects/native-federation:build-notifications     // req.url
after: /@angular-architects/native-federation:build-notifications      // url
goal: /@angular-architects/native-federation:build-notifications       // this.endpoint
 INFO  [Federation SSE] Client connected. Active connections: 1

It also seems like you can customize the endpoint in the options:
https://github.com/angular-architects/module-federation-plugin/blob/1923ddcabe49ddab2aff88601a53cbeb4cd98b58/libs/native-federation/src/builders/build/schema.json#L68C5-L82C6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants