nrwl / nx

Smart Monorepos ยท Fast CI
https://nx.dev
MIT License
23.78k stars 2.37k forks source link

MFE Remotes stopped working with 19.5.2 #27773

Open rbirkgit opened 2 months ago

rbirkgit commented 2 months ago

Current Behavior

We have an MFE enabled application with several remotes. All was working fine with 19.4.1. WHen we updated to 19.5.2 it all stopped working. I later tried updating to 19.6.5 and still not working.

Expected Behavior

I expect my remotes to still work start up.

GitHub Repo

No response

Steps to Reproduce

I'm not sure what the issue is. But before each remote started up on its own port. Our proxy file has all the redirects for each remote to go to each port.

Now when I yarn start the application, only one port is started up. I tried updating our proxy file to redirect to that port, but no success.

I find it strange such a big breaking change happened in a point release with no info how to handle it.

Nx Report

Node           : 20.16.0
OS             : win32-x64
Native Target  : x86_64-windows
yarn           : 4.3.1

nx                 : 19.6.5
@nx/js             : 19.6.5
@nx/jest           : 19.6.5
@nx/linter         : 19.6.5
@nx/eslint         : 19.6.5
@nx/workspace      : 19.6.5
@nx/angular        : 19.6.5
@nx/cypress        : 19.6.5
@nx/devkit         : 19.6.5
@nx/eslint-plugin  : 19.6.5
@nx/playwright     : 19.6.5
@nrwl/tao          : 19.6.5
@nx/vite           : 19.6.5
@nx/web            : 19.6.5
@nx/webpack        : 19.6.5
typescript         : 5.4.5

Failure Logs

No response

Package Manager Version

No response

Operating System

Additional Information

In our existing proxy file we have redirects like this:

  '/automation/plugin/deployment': {
    target: 'https://localhost.vmware.com:4201',
    secure: false,
    logLevel: 'debug',
    pathRewrite: {
      '^/automation/plugin/deployment': '',
    },
  },

With 19.5.2+ now all remotes start up on 4206. I tried updating to this, but no go.

  '/automation/plugin/deployment': {
    target: 'https://localhost.vmware.com:4206',
    secure: false,
    logLevel: 'debug',
    pathRewrite: {
      '^/automation/plugin/deployment': 'deployment',
    },
  },
rbirkgit commented 2 months ago

Is there any info about this breaking change and how to update our code to support it?

rbirkgit commented 2 months ago

This is what I see on startup:


 NX  Starting module federation dev-server for automation with 4 remotes
 NX  Building 4 static remotes...
 NX  Built 4 static remotes
 NX  Starting static remotes proxies...
 NX  Static remotes proxies started successfully
Warning: Running a server with --disable-host-check is a security risk. See https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a for more information.
Starting up http-server, serving dist/apps/plugin through https

http-server version: 14.1.1

http-server settings:
CORS: true
Cache: -1 seconds
Connection Timeout: 120 seconds
Directory Listings: visible
AutoIndex: visible
Serve GZIP Files: false
Serve Brotli Files: false
Default File Extension: none

Available on:
  https://localhost.vmware.com:4206

There is a line about remote proxies, but not sure what that is or where to find them.

rbirkgit commented 2 months ago

The stranger thing is that remoteEntry.mjs files are no longer loaded (and no error). Before with 19.4.1 our remotes loaded these files. Now with 19.5.2+ they are no longer loaded.

We did no changes other than update Nx.

turnerguo commented 2 months ago

check if nx has changed mfe config schema?

Aubrey-Russell commented 2 months ago

bump this is a real problem

Error: [ Module Federation Manifest Plugin ]: no files found for remoteEntry chunk
Aubrey-Russell commented 2 months ago

still fails on 19.7.2

Coly010 commented 2 months ago

Your existing proxy config might be conflicting with our new proxy approach for remotes.

Could you provide a minimal repo with a reproduction of this so i can confirm and get a fix for you? @rbirkgit

github-actions[bot] commented 2 weeks ago

This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™

nhhockeyplayer commented 1 week ago

Im getting similar issue now since yesterdays upgrade

one of my remotes is hanging up entire serve launch ADDRINUSE

Colum I gave you admin access to allow you access to my packages in case you want to investigate my repo

 NX  Static remotes proxies started successfully
Connecting on localhost:4204
Connecting on localhost:4201
Connecting on localhost:4202
Connecting on localhost:4203
node:events:497
      throw er; // Unhandled 'error' event
      ^
Error: listen EADDRINUSE: address already in use :::4201
    at Server.setupListenHandle [as _listen2] (node:net:1908:16)
    at listenInCluster (node:net:1965:12)
    at Server.listen (node:net:2067:7)
    at startRemoteProxies (/Users/meanstack02/meanstacknh/node_modules/@nx/webpack/src/utils/module-federation/start-remote-proxies.js:33:14)
    at moduleFederationDevServerExecutor (/Users/meanstack02/meanstacknh/node_modules/@nx/angular/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js:77:51)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async getLastValueFromAsyncIterableIterator (/Users/meanstack02/meanstacknh/node_modules/nx/src/utils/async-iterator.js:15:19)
    at async iteratorToProcessStatusCode (/Users/meanstack02/meanstacknh/node_modules/nx/src/command-line/run/run.js:39:25)
    at async handleErrors (/Users/meanstack02/meanstacknh/node_modules/nx/src/utils/handle-errors.js:8:24)
    at async process.<anonymous> (/Users/meanstack02/meanstacknh/node_modules/nx/bin/run-executor.js:59:28)
Emitted 'error' event on Server instance at:
    at emitErrorNT (node:net:1944:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
  code: 'EADDRINUSE',
  errno: -48,
  syscall: 'listen',
  address: '::',
  port: 4201
}
Node.js v22.9.0
github-actions[bot] commented 3 days ago

This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™