nrwl / nx

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

Serving multiple apps fail when depending on buildable libraries #18106

Closed MarcusElevait closed 9 months ago

MarcusElevait commented 1 year ago

Current Behavior

When running the command nx run-many --target=serve --projects=tag:backend, it crashes while building the apps. The apps depend on some buildable libraries we have in our project. The log shows then something like this:

>  NX   Running target build for project app1 and 30 tasks it depends on failed

   Failed tasks:

   - lib1:build

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

The library that is stated under the Failed tasks section is not always the same.

When i serve the apps sequentially it works fine. Building the apps in parallel works fine. So the workaround for now is to run this command before the serve command: nx run-many --target=build --projects=tag:backend

Because then the cache is used when serving the apps.

Here is the project.json of one of the apps:

    "targets": {
        "build": {
            "executor": "@nrwl/webpack:webpack",
            "dependsOn": ["^build"],
            "options": {
                "outputPath": "dist/apps/aicobe",
                "main": "apps/aicobe/src/main.ts",
                "tsConfig": "apps/aicobe/tsconfig.app.json",
                "tsPlugins": [
                    {
                        "name": "@nestjs/swagger/plugin",
                        "options": {
                            "introspectComments": true
                        }
                    }
                ],
                "assets": ["apps/aicobe/src/assets"],
                "buildLibsFromSource": true,
                "maxWorkers": 1,
                "memoryLimit": 1024,
                "target": "node",
                "compiler": "tsc",
                "generatePackageJson": true
            },
            "configurations": {
                "production": {
                    "optimization": true,
                    "extractLicenses": true,
                    "inspect": false,
                    "fileReplacements": [
                        {
                            "replace": "apps/aicobe/src/environments/environment.ts",
                            "with": "apps/aicobe/src/environments/environment.prod.ts"
                        }
                    ]
                }
            },
            "outputs": ["{options.outputPath}"]
        },
        "serve": {
            "executor": "@nx/js:node",
            "options": {
                "buildTarget": "aicobe:build",
                "port": 7778
            }
        }
    }

Expected Behavior

I would expect, that serving multiple apps in parallel, that depend on the same buildable libraries, will not fail.

GitHub Repo

No response

Steps to Reproduce

  1. Create multiple apps
  2. Create some buildable libraries
  3. Let the apps dependend on the same libraries
  4. Run nx run-many --target=serve for those apps

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 18.16.0
   OS     : linux-x64
   npm    : 9.5.1

   nx (global)        : 16.3.2
   nx                 : 16.5.0
   @nx/js             : 16.5.0
   @nx/jest           : 16.5.0
   @nx/linter         : 16.5.0
   @nx/workspace      : 16.5.0
   @nx/angular        : 16.5.0
   @nx/cypress        : 16.5.0
   @nx/devkit         : 16.5.0
   @nx/esbuild        : 16.5.0
   @nx/eslint-plugin  : 16.5.0
   @nx/nest           : 16.5.0
   @nx/node           : 16.5.0
   @nx/plugin         : 16.5.0
   @nrwl/tao          : 16.5.0
   @nx/webpack        : 16.5.0
   nx-cloud           : 16.0.5
   typescript         : 5.1.6
   ---------------------------------------
   Community plugins:
   @datorama/akita       : 2.2.4
   @ngrx/component-store : 16.0.1
   @ngrx/effects         : 16.0.1
   @ngrx/entity          : 16.0.1
   @ngrx/router-store    : 16.0.1
   @ngrx/schematics      : 16.0.1
   @ngrx/store           : 16.0.1
   @ngrx/store-devtools  : 16.0.1
   @rx-angular/cdk       : 1.0.0
   @rx-angular/template  : 1.0.0
   ng-mocks              : 14.10.0
   ---------------------------------------
   Local workspace plugins:
         @aicosy/angular/tooltip-if-truncated-directive
         @aicosy/angular/edit-parent-collection-dialog
         @aicosy/angular/navigation-toolbar-component
         @aicosy/nest/check-allowed-string-values-pipe
         @aicosy/angular/process-information-dialog
         @aicosy/angular/classification-annotation-data-access
         @aicosy/angular/force-leave-confirmation-guard
         @aicosy/angular/bounding-box-annotations-data-access
         @aicosy/angular/file-drop-zone-component
         @aicosy/angular/toolbar-action-component
         @aicosy/frontend/directives/highlight-term-directive
         @aicosy/angular/extract-url-last-segment-pipe
         @aicosy/angular/mat-paginator-intl-service
         @aicosy/angular/annotation-types-dialog
         @aicosy/angular/feature-flags-directive
         @aicosy/angular/quick-filter-component
         @aicosy/frontend/components/single-annotation-item
         @aicosy/angular/user-permission-dialog
         @aicosy/angular/authenticate-directive
         @aicosy/angular/map-object-to-property-pipe
         @aicosy/frontend/components/classes-to-use-dialog
         @aicosy/angular/code-editor-component
         @aicosy/angular/list-selection-dialog
         @aicosy/angular/drag-n-drop-directive
         @aicosy/frontend/components/adjacency-navigation
         @aicosy/frontend/user-configurations-data-access
         @aicosy/angular-permissions-management
         @aicosy/frontend/pipes/translate-rdf-lang-string
         @aicosy/nest/parse-query-id-array-pipe
         @aicosy/frontend/directives/autofocus-directive
         @aicosy/angular-attributes-management
         @aicosy/frontend/data-access/entity-annotation
         @aicosy/angular/on-hover-directive
         @elevait/text-annotation-tool
         @aicosy/angular/auth-interceptor
         @aicosy/frontend/pipes/shorten-rdf-prefix-pipe
         @aicosy/frontend/utils/editor-params-extractor
         @aicosy/angular/attributes-dialog
         @aicosy/angular/chips-multiselect
         @aicosy/angular/spinner-component
         @aicosy/angular/annotation-types-data-access
         @aicosy/angular-resource-management
         @aicosy/angular/without-namespace-pipe
         @aicosy/angular/filter-component
         @aicosy/angular/header-component
         @aicosy/angular/loader-component
         @aicosy/angular/property-shapes
         @aicosy/angular/task-management-data-access
         @aicosy/angular/async-or-loading
         @aicosy/angular/annotation-sidebar
         @aicosy/angular/login-redirect-guard
         @aicosy/angular/camel-case-split-pipe
         @aicosy/nest/groups-decorator
         @aicosy/backend/pipes/validate-sorting-pipe
         @aicosy/frontend/components/class-hierarchy
         @aicosy/angular/login-component
         @aicosy/angular/ocr-annotation-data-access
         @aicosy/angular/resource-shape-data-access
         @aicosy/angular/interpreted-model
         @aicosy/angular/confirm-dialog
         @aicosy/angular/icon-component
         @aicosy/angular/logo-component
         @aicosy/frontend/components/node-hierarchy
         @aicosy/angular/sort-component
         @aicosy/angular/warning-dialog
         @aicosy/angular/creative-work-data-access
         @aicosy/angular/document-page-data-access
         @aicosy/angular/document-part-data-access
         @aicosy/angular/feature-flags-data-access
         @aicosy/angular/resource-data-data-access
         @aicosy/angular/shacl-service
         @aicosy/frontend/data-access/text-document
         @aicosy/angular/create-cosy-item
         @aicosy/angular/rules-management
         @aicosy/angular/feature-flag-guard
         @aicosy/angular/replace-string-pipe
         @aicosy/shared/translation-factory
         @aicosy/frontend/components/export-dialog
         @aicosy/angular/rename-dialog
         @aicosy/angular/select-dialog
         @aicosy/frontend/components/sidebar-ghost
         @aicosy/angular/aibaip-proxy-data-access
         @aicosy/angular/flow-insight-data-access
         @elevait/extraction-view
         @aicosy/frontend/features/system-settings
         @aicosy/angular/task-management
         @aicosy/angular/permissions-guard
         @aicosy/angular/download-json-pipe
         @aicosy/angular/dialogs-service
         @aicosy/angular/about-dialog
         @aicosy/angular/triplestore-data-access
         @aicosy/angular/get-initials-pipe
         @aicosy/angular/rule-comment-pipe
         @aicosy/nest/valid-string-pipe
         @aicosy/angular/breadcrumbs
         @aicosy/angular/attributes-data-access
         @aicosy/angular/collection-data-access
         @aicosy/angular/permission-data-access
         @aicosy/angular/rdfs-class-data-access
         @aicosy/angular/feature-flags
         @aicosy/angular/upload-window
         @aicosy/frontend/features/user-settings
         @aicosy/angular/rgba-to-hex-pipe
         @aicosy/angular/feature-flags-service
         @aicosy/angular/ldap-user-store
         @aicosy/angular/resource-shapes
         @aicosy/angular/frontend-object-constants
         @aicosy/backend/editor-type-pipe
         @aicosy/angular/error-view
         @aicosy/angular/list-ghost
         @aicosy/frontend/components/no-content
         @aicosy/angular/cosy-item-data-access
         @aicosy/angular/resources-data-access
         @elevait/forms-editor
         @elevait/rules-editor
         @aicosy/frontend/pipes/safe-image-pipe
         @aicosy/angular/split-last-pipe
         @aicosy/angular/icon-service
         @aicosy/angular/notification
         @aicosy/rdf-tools/ui-generation-model
         @aicosy/nest/logging
         @aicosy/nest/mongoose-models
         @aicosy/angular/document-data-access
         @aicosy/angular/docs-editor
         @aicosy/angular/text-editor
         @aicosy/angular/safe-html-pipe
         @aicosy/angular/resource-data
         @aicosy/nest/sentry
         @elevait/map-view
         @elevait/ocr-editor
         @aicosy/angular/svg-editor
         @aicosy/angular/browser-utils
         @aicosy/rdf-tools/prefixes
         @aicosy/shared/generate-json-schema
         @aicosy/nest/groups-guard
         @aicosy/backend/pipes/feature-flags
         @aicosy/nest/miscellaneous-utils
         @aicosy/nx-tools
         @aicosy/shared/mongodb-collections
         @aicosy/shared/primitive-constants
         @aicosy/angular/rules-data-access
         @aicosy/angular/auth-guard
         @aicosy/nest/bearer-auth
         @aicosy/angular/ldap-data-access
         @aicosy/frontend/services/backend
         @aicosy/angular/interfaces
         @aicosy/angular/sentry
         @aicosy/angular/config
         @aicosy/angular/socket-service
         @aicosy/rdf-tools/rdfs
         @aicosy/frontend/rdf-tools-demo
         @aicosy/shared/object-constants
         @aicosy/rdf-tools/edm
         @aicosy/rdf-tools/rdf
         @aicosy/rdf-tools/shn
         @aicosy/rdf-tools/xsd
         @aicosy/angular/auth-service
         @aicosy/rdf-tools/sh
         @aicosy/shared/shacl-rules
         @aicosy/angular/shacl-table
         @aicosy/shacl-form
         @aicosy/shacl-json
         @aicosy/angular/node-form
         @aicosy/color-utils
         @aicosy/shared/permissions
         @aicosy/nest/auth
         @aicosy/jest/utils
         @aicosy/data-models/shared-interfaces
         @aicosy/rdf-tools/jsonld
         @aicosy/ai-utils
         @aicosy/shared/enums
         @aicosy/data-models/dtos

Failure Logs

No response

Operating System

Additional Information

No response

github-actions[bot] commented 10 months ago

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

github-actions[bot] commented 8 months ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.