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.

Multiple Host MF app fail to start with devRemotes

See original GitHub issue

Current Behavior

I’ve followed the guide from official docs, and run command below nx g @nrwl/react:host shell --remotes=shop,cart And then I added some configuration to run as multiple hosts app. My configurations is like this

// shell
module.exports = {
  name: 'shell',
  remotes: ['shop', 'cart'],
  exposes: {
    './queryClient': './src/queryClient',
    './atoms': './src/atoms',
  },
};
// cart
module.exports = {
  name: 'cart',
  remotes: ['shell'],
  exposes: {
    './Module': './src/remote-entry',
  },
};

nx serve shell and nx serve cart runs fine but it fails with nx serve shell --devRemotes cart,shop. I think it try to run shell multiple times, so that makes the error.

Expected Behavior

nx serve shell --devRemotes cart,shop runs fine with multiple host set-up.

Steps to Reproduce

set configuration above and run nx serve shell --devRemotes cart,shop my repo

Failure Logs

Error: listen EADDRINUSE: address already in use 127.0.0.1:4200
    at Server.setupListenHandle [as _listen2] (node:net:1330:16)
    at listenInCluster (node:net:1378:12)
    at GetAddrInfoReqWrap.doListen [as callback] (node:net:1516:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:73:8) {
  code: 'EADDRINUSE',
  errno: -48,
  syscall: 'listen',
  address: '127.0.0.1',
  port: 4200
}

Running target "shell:serve" failed

   Failed tasks:
   
   - shell:serve:development
   
   Hint: run the command with --verbose for more details.

node:internal/process/promises:279                                                                                                                          
            triggerUncaughtException(err, true /* fromPromise */);
            ^

RpcIpcMessagePortClosedError: Cannot send the message - the message port has been closed for the process 44978.
    at /Users/ijeongjae/Desktop/workspace/nx-test/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:47:47
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: undefined,
  signal: undefined
}
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

RpcIpcMessagePortClosedError: Cannot send the message - the message port has been closed for the process 44979.
    at /Users/ijeongjae/Desktop/workspace/nx-test/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:47:47
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: undefined,
  signal: undefined
}

Environment

   Node : 16.14.1
   OS   : darwin arm64
   yarn : 1.22.18
   
   nx : 14.3.6
   @nrwl/angular : Not Found
   @nrwl/cypress : 14.3.6
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.3.6
   @nrwl/eslint-plugin-nx : 14.3.6
   @nrwl/express : Not Found
   @nrwl/jest : 14.3.6
   @nrwl/js : 14.3.6
   @nrwl/linter : 14.3.6
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 14.3.6
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.3.6
   @nrwl/web : 14.3.6
   @nrwl/workspace : 14.3.6
   typescript : 4.7.4
   ---------------------------------------
   Community plugins:

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
franktroiacommented, Aug 3, 2022

Aha. I think the issue is with my module-federation.config.js. The remotes array needs to be empty since I’m doing dynamic module federation. Once I made the remotes array empty, it worked.

0reactions
Aleksidiuscommented, Nov 18, 2022

Hey until this is fixed, I believe this works:

nx serve shell --open --devRemotes=feature-c --devRemotes=feature-b --devRemotes=remote

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setup Module Federation in Angular with Nx | by Colum Ferry
Updates the Host application's app.module.ts to set up a Route for the remote application. Within each of our remote applications, we'll want to ......
Read more >
Advanced Angular Micro Frontends with Dynamic Module ... - Nx
We need to generate two applications that support Module Federation. We'll start with the Admin Dashboard application which will act as a host...
Read more >
Building React Micro Frontends Monorepo with State ...
Proof of Concept. Usually, when we build micro frontend applications, we create one shell application (or host, container) and multiple remote micro frontend ......
Read more >
Nx CLI run many command is not working for multiple apps
Try this: nx run-many --parallel --target=serve --projects=frontend,backend.
Read more >
nrwl/linter: Versions - Openbase
angular: add error handling for cypress mf to correct file #12118 (#12234) ... angular: warning logged when generating MF app with no e2e...
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