nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.69k stars 2.36k forks source link

MFE port collision during serve - host+remote(s) hung EADDRINUSE #28965

Open nhhockeyplayer opened 5 hours ago

nhhockeyplayer commented 5 hours ago

Current Behavior

Im getting new issue now since yesterdays upgrade

one of my remotes is hanging up entire serve launch EADDRINUSE

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

this was working fine all week

seems some internal collision

Im researching new vs old configs for MFE

Expected Behavior

Host should launch with remotes without incident

GitHub Repo

https://github.com/nhhockeyplayer/meanstacknh

Steps to Reproduce

there is a ".clean.zsh" script at project root which depicts steps to reproduce automated launch that

OR

npm install nx run-many --all --target=build nx run ui-host:run-serve --verbose

Nx Report

nx report

 NX   Report complete - copy this into the issue template

Node           : 22.9.0
OS             : darwin-x64
Native Target  : x86_64-macos
npm            : 10.9.0

nx (global)        : 20.0.0
nx                 : 20.1.0
@nx/js             : 20.1.0
@nx/jest           : 20.1.0
@nx/eslint         : 20.1.0
@nx/workspace      : 20.1.0
@nx/angular        : 20.1.0
@nx/cypress        : 20.1.0
@nx/devkit         : 20.1.0
@nx/esbuild        : 20.1.0
@nx/eslint-plugin  : 20.1.0
@nx/express        : 20.1.0
@nx/nest           : 20.1.0
@nx/node           : 20.1.0
@nx/web            : 20.1.0
@nx/webpack        : 20.1.0
nx-cloud           : 19.1.0
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/cypress/plugin
@nx/eslint/plugin
---------------------------------------
Community plugins:
@compodoc/compodoc               : 1.1.26
@fortawesome/angular-fontawesome : 0.15.0
@ionic/angular                   : 6.7.5
@jsverse/transloco               : 7.5.0
@ngrx/component                  : 18.0.2
@ngrx/component-store            : 18.0.2
@ngrx/effects                    : 18.0.2
@ngrx/entity                     : 18.0.2
@ngrx/operators                  : 18.0.2
@ngrx/router-store               : 18.0.2
@ngrx/schematics                 : 18.0.2
@ngrx/store                      : 18.0.2
@ngrx/store-devtools             : 18.0.2
apollo-angular                   : 7.2.1

Failure Logs

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

Package Manager Version

npm --version 10.9.0

Operating System

Additional Information

No response

nhhockeyplayer commented 3 hours ago

on the specified repo, seeing multiple contention for ports and public_hosts

nx run run-serve

 NX   Both project and target have to be specified

Error: Both project and target have to be specified
    at parseRunOneOptions (/Users/meanstack02/meanstacknh/node_modules/nx/src/command-line/run/run-one.js:96:15)
    at Object.runOne (/Users/meanstack02/meanstacknh/node_modules/nx/src/command-line/run/run-one.js:23:18)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async /Users/meanstack02/meanstacknh/node_modules/nx/src/command-line/run/command-object.js:19:13
    at async handleErrors (/Users/meanstack02/meanstacknh/node_modules/nx/src/utils/handle-errors.js:8:24)
    at async Object.handler (/Users/meanstack02/meanstacknh/node_modules/nx/src/command-line/run/command-object.js:18:26)

meanstack02@admin meanstacknh % nx run ui-host:run-serve
[NX CLOUD] Using light client
[NX CLOUD] A local bundle currently exists:  {
  version: '2411.13.2',
  fullPath: '/Users/meanstack02/meanstacknh/node_modules/.cache/nx/cloud/2411.13.2'
}
[NX CLOUD] Last verification was more than 30 minutes ago, verifying bundle is still valid
[NX CLOUD] Currently installed bundle is invalid, downloading version 2411.13.2  from  https://cloud.nx.app/nx-cloud/static/client-bundle
[NX CLOUD] Using bundle path:  {
  version: '2411.13.2',
  fullPath: '/Users/meanstack02/meanstacknh/node_modules/.cache/nx/cloud/2411.13.2'
}
Was not able to require.resolve module nx/src/utils/app-root from the following paths: /Users/meanstack02/meanstacknh/node_modules/nx-cloud/node_modules,/Users/meanstack02/meanstacknh/node_modules. This may be expected.
Was not able to require.resolve module nx/src/utils/app-root from the following paths: /Users/meanstack02/meanstacknh/node_modules/nx-cloud/node_modules,/Users/meanstack02/meanstacknh/node_modules. This may be expected.
[Nx Cloud Debug] Attempting to acquire filesystem lock with path:  /var/folders/73/pgw9tfdj5fz826zd6cc4p0vr0000gn/T/client-instance-id.lock
[Nx Cloud Debug] Failed to create folder lock at path: /var/folders/73/pgw9tfdj5fz826zd6cc4p0vr0000gn/T/client-instance-id.lock
[Nx Cloud] Unable to detect a VCS context from the environment.

 NX   RunStart

{
  "meta": {},
  "branch": null,
  "runGroup": "7d59182597480ca344498bd914aba07e429bd26c",
  "ciExecutionId": null,
  "ciExecutionEnv": "",
  "hashes": [
    "15990719094112380393"
  ],
  "machineInfo": {
    "machineId": "uHiOzR0l5SEx0kjZqAemHQ==",
    "platform": "darwin",
    "version": "Darwin Kernel Version 21.6.0: Mon Jun 24 00:56:10 PDT 2024; root:xnu-8020.240.18.709.2~1/RELEASE_X86_64",
    "cpuCores": 8
  },
  "vcsContext": null,
  "clientInstanceSource": "CLOUD_RUNNER",
  "clientInstanceId": "f131bbd2-6a28-464f-aa87-705386c84174"
}

> nx run ui-host:run-serve

> nx serve ui-host --devRemotes=ui-auth,ui-nav,ui-dashboard --tsConfig=libs/shared/root/i18n/tsconfig.lib.json

RunStart duration: 105
[NX CLOUD] Using light client
[NX CLOUD] A local bundle currently exists:  {
  version: '2411.13.2',
  fullPath: '/Users/meanstack02/meanstacknh/node_modules/.cache/nx/cloud/2411.13.2'
}
[NX CLOUD] Last verification was within the past 30 minutes, will not verify this time
[NX CLOUD] Using bundle path:  {
  version: '2411.13.2',
  fullPath: '/Users/meanstack02/meanstacknh/node_modules/.cache/nx/cloud/2411.13.2'
}
Was not able to require.resolve module nx/src/utils/app-root from the following paths: /Users/meanstack02/meanstacknh/node_modules/nx-cloud/node_modules,/Users/meanstack02/meanstacknh/node_modules. This may be expected.
Was not able to require.resolve module nx/src/utils/app-root from the following paths: /Users/meanstack02/meanstacknh/node_modules/nx-cloud/node_modules,/Users/meanstack02/meanstacknh/node_modules. This may be expected.

> nx run ui-host:serve:development --devRemotes=ui-auth,ui-nav,ui-dashboard --tsConfig=libs/shared/root/i18n/tsconfig.lib.json

 NX   'tsConfig' is not found in schema
'tsConfig' is not found in schema

 NX   Running target serve for project ui-host failed

Failed tasks:

- ui-host:serve:development

Hint: run the command with --verbose for more details.

Warning: command "nx serve ui-host --devRemotes=ui-auth,ui-nav,ui-dashboard --tsConfig=libs/shared/root/i18n/tsconfig.lib.json" exited with non-zero status code
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Running target run-serve for project ui-host failed

Failed tasks:

- ui-host:run-serve

Hint: run the command with --verbose for more details.

 NX   Storing terminal outputs for ui-host:run-serve with hash 15990719094112380393

View structured, searchable error logs at https://nx.app/runs/DOrLd0kuCJ

meanstack02@admin meanstacknh % nx run ui-host:run-serve
[NX CLOUD] Using light client
[NX CLOUD] A local bundle currently exists:  {
  version: '2411.13.2',
  fullPath: '/Users/meanstack02/meanstacknh/node_modules/.cache/nx/cloud/2411.13.2'
}
[NX CLOUD] Last verification was within the past 30 minutes, will not verify this time
[NX CLOUD] Using bundle path:  {
  version: '2411.13.2',
  fullPath: '/Users/meanstack02/meanstacknh/node_modules/.cache/nx/cloud/2411.13.2'
}
Was not able to require.resolve module nx/src/utils/app-root from the following paths: /Users/meanstack02/meanstacknh/node_modules/nx-cloud/node_modules,/Users/meanstack02/meanstacknh/node_modules. This may be expected.
Was not able to require.resolve module nx/src/utils/app-root from the following paths: /Users/meanstack02/meanstacknh/node_modules/nx-cloud/node_modules,/Users/meanstack02/meanstacknh/node_modules. This may be expected.

> nx run ui-host:run-serve

> nx serve ui-host --devRemotes=ui-auth,ui-nav,ui-dashboard

[Nx Cloud Debug] Attempting to acquire filesystem lock with path:  /var/folders/73/pgw9tfdj5fz826zd6cc4p0vr0000gn/T/client-instance-id.lock
[Nx Cloud Debug] Failed to create folder lock at path: /var/folders/73/pgw9tfdj5fz826zd6cc4p0vr0000gn/T/client-instance-id.lock
[Nx Cloud] Unable to detect a VCS context from the environment.

 NX   RunStart

{
  "meta": {},
  "branch": null,
  "runGroup": "7d59182597480ca344498bd914aba07e429bd26c",
  "ciExecutionId": null,
  "ciExecutionEnv": "",
  "hashes": [
    "5593389503126523062"
  ],
  "machineInfo": {
    "machineId": "uHiOzR0l5SEx0kjZqAemHQ==",
    "platform": "darwin",
    "version": "Darwin Kernel Version 21.6.0: Mon Jun 24 00:56:10 PDT 2024; root:xnu-8020.240.18.709.2~1/RELEASE_X86_64",
    "cpuCores": 8
  },
  "vcsContext": null,
  "clientInstanceSource": "CLOUD_RUNNER",
  "clientInstanceId": "f131bbd2-6a28-464f-aa87-705386c84174"
}

RunStart duration: 126
[NX CLOUD] Using light client
[NX CLOUD] A local bundle currently exists:  {
  version: '2411.13.2',
  fullPath: '/Users/meanstack02/meanstacknh/node_modules/.cache/nx/cloud/2411.13.2'
}
[NX CLOUD] Last verification was within the past 30 minutes, will not verify this time
[NX CLOUD] Using bundle path:  {
  version: '2411.13.2',
  fullPath: '/Users/meanstack02/meanstacknh/node_modules/.cache/nx/cloud/2411.13.2'
}
Was not able to require.resolve module nx/src/utils/app-root from the following paths: /Users/meanstack02/meanstacknh/node_modules/nx-cloud/node_modules,/Users/meanstack02/meanstacknh/node_modules. This may be expected.
Was not able to require.resolve module nx/src/utils/app-root from the following paths: /Users/meanstack02/meanstacknh/node_modules/nx-cloud/node_modules,/Users/meanstack02/meanstacknh/node_modules. This may be expected.

> nx run ui-host:serve:development --devRemotes=ui-auth,ui-nav,ui-dashboard

 NX  Starting module federation dev-server for ui-host with 6 remotes
 NX  Starting static remotes proxies...
 NX  Static remotes proxies started successfully
Connecting on localhost:4201
Connecting on localhost:4203
Connecting on localhost:4202
Connecting on localhost:4201
Connecting on localhost:4202
Connecting on localhost:4203
- Generating browser application bundles (phase: setup)...
    TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browserslist configuration. For more information, see https://angular.dev/tools/cli/build#configuring-browser-compatibility
    NOTE: You can set the "target" to "ES2022" in the project's tsconfig to remove this warning.
- Generating browser application bundles (phase: setup)...
- Generating browser application bundles (phase: setup)...
- Generating browser application bundles (phase: setup)...
- Generating browser application bundles (phase: setup)...
- Generating browser application bundles (phase: setup)...
- Generating browser application bundles (phase: setup)...
    TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browserslist configuration. For more information, see https://angular.dev/tools/cli/build#configuring-browser-compatibility
    NOTE: You can set the "target" to "ES2022" in the project's tsconfig to remove this warning.
    TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browserslist configuration. For more information, see https://angular.dev/tools/cli/build#configuring-browser-compatibility
    NOTE: You can set the "target" to "ES2022" in the project's tsconfig to remove this warning.
    TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browserslist configuration. For more information, see https://angular.dev/tools/cli/build#configuring-browser-compatibility
    NOTE: You can set the "target" to "ES2022" in the project's tsconfig to remove this warning.
    TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browserslist configuration. For more information, see https://angular.dev/tools/cli/build#configuring-browser-compatibility
    NOTE: You can set the "target" to "ES2022" in the project's tsconfig to remove this warning.
    TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browserslist configuration. For more information, see https://angular.dev/tools/cli/build#configuring-browser-compatibility
    NOTE: You can set the "target" to "ES2022" in the project's tsconfig to remove this warning.
    TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browserslist configuration. For more information, see https://angular.dev/tools/cli/build#configuring-browser-compatibility
    NOTE: You can set the "target" to "ES2022" in the project's tsconfig to remove this warning.
[ Module Federation Manifest Plugin ]: Manifest will use absolute path resolution via its host at runtime, reason: publicPath='auto'
<i> [webpack-dev-server] [HPM] Proxy created: /jsonbff  -> http://localhost:4000
    [webpack-dev-server] [HPM] Subscribed to http-proxy events: [ 'error', 'close' ]
<i> [webpack-dev-server] [HPM] Proxy created: /gqlbff  -> http://localhost:3000
    [webpack-dev-server] [HPM] Subscribed to http-proxy events: [ 'error', 'close' ]
[ Module Federation Manifest Plugin ]: Manifest will use absolute path resolution via its host at runtime, reason: publicPath='auto'
 NX   Invalid options object. Container Plugin has been initialized using an options object that does not match the API schema.
 - options.experiments has an unknown property 'outputModule'. These properties are valid:
   object { federationRuntime? }
ValidationError: Invalid options object. Container Plugin has been initialized using an options object that does not match the API schema.
 - options.experiments has an unknown property 'outputModule'. These properties are valid:
   object { federationRuntime? }
    at validate (/Users/meanstack02/meanstacknh/node_modules/webpack/node_modules/schema-utils/dist/validate.js:191:11)
    at /Users/meanstack02/meanstacknh/node_modules/webpack/lib/util/create-schema-validation.js:16:17
    at new ContainerPlugin (/Users/meanstack02/meanstacknh/node_modules/@module-federation/enhanced/src/lib/container/ContainerPlugin.ts:46:5)
    at /Users/meanstack02/meanstacknh/node_modules/@module-federation/enhanced/src/lib/container/ModuleFederationPlugin.ts:124:9
    at Hook.eval (eval at create (/Users/meanstack02/meanstacknh/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
    at Hook.CALL_DELEGATE [as _call] (/Users/meanstack02/meanstacknh/node_modules/tapable/lib/Hook.js:14:14)
    at WebpackOptionsApply.process (/Users/meanstack02/meanstacknh/node_modules/webpack/lib/WebpackOptionsApply.js:723:31)
    at createCompiler (/Users/meanstack02/meanstacknh/node_modules/webpack/lib/webpack.js:94:28)
    at create (/Users/meanstack02/meanstacknh/node_modules/webpack/lib/webpack.js:154:16)
    at webpack (/Users/meanstack02/meanstacknh/node_modules/webpack/lib/webpack.js:182:32)

 NX   Running target serve for project ui-host failed

Failed tasks:

- ui-host:serve:development

Hint: run the command with --verbose for more details.

Warning: command "nx serve ui-host --devRemotes=ui-auth,ui-nav,ui-dashboard" exited with non-zero status code
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Running target run-serve for project ui-host failed

Failed tasks:

- ui-host:run-serve

Hint: run the command with --verbose for more details.

 NX   Storing terminal outputs for ui-host:run-serve with hash 5593389503126523062

View structured, searchable error logs at https://nx.app/runs/dYVHuIsF4R

meanstack02@admin meanstacknh %