remix icon indicating copy to clipboard operation
remix copied to clipboard

Remix server runs (by NX) and fails after short time without not specific error

Open kosiakMD opened this issue 1 year ago • 3 comments

Reproduction

First of all, I know that's it could be the issue with @nx/remix runner, but if not might be can help me here?

  1. Navigate to the project directory in the terminal.
  2. Run the command nx serve web to start the NX Remix application.
  3. Observe that the process enters into a recursive or infinite loop.
  4. Attempt to connect to the local server at 127.0.0.1:3000.
  5. Observe the ECONNREFUSED error.

System Info

System:
    OS: macOS 14.2.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 48.20 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.0.0 - ~/.nvm/versions/node/v21.0.0/bin/node
    Yarn: 1.22.21 - /opt/homebrew/bin/yarn
    npm: 10.2.0 - ~/.nvm/versions/node/v21.0.0/bin/npm
    Watchman: 2024.03.18.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 123.0.6312.59
    Safari: 17.2.1
  npmPackages:
    @remix-run/css-bundle: ^2.8.1 => 2.8.1 
    @remix-run/dev: ^2.8.1 => 2.8.1 
    @remix-run/eslint-config: ^2.8.1 => 2.8.1 
    @remix-run/node: ^2.8.1 => 2.8.1 
    @remix-run/react: ^2.8.1 => 2.8.1 
    @remix-run/router: ^1.15.3 => 1.15.3 
    @remix-run/serve: ^2.8.1 => 2.8.1 
    @remix-run/testing: ^2.8.1 => 2.8.1

Used Package Manager

npm

Expected Behavior

Expected Behavior: The nx serve web command should start the NX Remix application without additional infinite connection logs. The application should run and listen on 127.0.0.1:3000 without refusing connections.

Actual Behavior

Current Behavior: When running the nx serve web command to start the NX Remix application, the process infinitely logs "Connecting on 127.0.0.1:3000" every second. The app works. The process runs indefinitely until it's suddenly stopped. Additionally, when trying to connect to the local server at 127.0.0.1:3000, the connection is refused with an ECONNREFUSED error.

kosiakMD avatar Mar 27 '24 20:03 kosiakMD

Could you provide a minimal reproduction repo?

brophdawg11 avatar Mar 29 '24 13:03 brophdawg11

@brophdawg11 basically, the issue is only on my own Mac, all the rest developers aren't struggling with this I cleaned caches, node modules, updated remix and nx, and still the same result I'm mostly asking about any assumptions or suggestions on where to look or what to change in some configs Before adding additional logging to see connecting by nx server before Remix started, I was sure it was a watcher issue, but now I see it starts to connect before the remix build started

my remix app project file

{
  "name": "web",
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "sourceRoot": "apps/web",
  "projectType": "application",
  "tags": [],
  "targets": {
    "build": {
      "executor": "@nx/remix:build",
      "outputs": ["{options.outputPath}"],
      "options": {
        "outputPath": "dist/apps/web"
      },
      "configurations": {
        "production": {
          "sourcemap": false
        },
        "development": {
          "sourcemap": true
        }
      }
    },
    "lint": {
      "executor": "nx:run-commands",
      "options": {
        "command": "eslint ./src/**/*.{ts,tsx}",
        "cwd": "{projectRoot}"
      }
    },
    "lint-nx": {
      "executor": "@nx/eslint:lint",
      "outputs": ["{options.outputFile}"],
      "options": {
        "lintFilePatterns": ["apps/web/src/**/*.{ts,tsx}"]
      }
    },
    "serve": {
      "executor": "@nx/remix:serve",
      "options": {
        "port": 3000
      }
    },
    "start": {
      "dependsOn": ["build"],
      "command": "remix-serve build",
      "options": {
        "cwd": "apps/web"
      }
    },
    "typecheck": {
      "command": "tsc",
      "options": {
        "cwd": "apps/web"
      }
    },
    "storybook": {
      "executor": "@nx/storybook:storybook",
      "options": {
        "port": 4400,
        "configDir": "apps/web/.storybook"
      },
      "configurations": {
        "ci": {
          "quiet": true
        }
      }
    },
    "build-storybook": {
      "executor": "@nx/storybook:build",
      "outputs": ["{options.outputDir}"],
      "options": {
        "outputDir": "dist/storybook/web",
        "configDir": "apps/web/.storybook"
      },
      "configurations": {
        "ci": {
          "quiet": true
        }
      }
    },
    "test-storybook": {
      "executor": "nx:run-commands",
      "options": {
        "command": "test-storybook -c apps/web/.storybook --url=http://localhost:4400"
      }
    },
    "static-storybook": {
      "executor": "@nx/web:file-server",
      "options": {
        "buildTarget": "web:build-storybook",
        "staticFilePath": "dist/storybook/web"
      },
      "configurations": {
        "ci": {
          "buildTarget": "web:build-storybook:ci"
        }
      }
    },
    "docker-build": {
      "dependsOn": ["build"],
      "command": "docker build -f apps/web/Dockerfile . -t web"
    }
  }
}

kosiakMD avatar Mar 29 '24 14:03 kosiakMD

seems the issue that original dev serve run it on locahost and nx trying to connect to 127.0.0.1 but can't when run custom server with listen(port, process.env.HOST || '0.0.0.0',...) can access it by 127.0.0.1 can I modify host?

kosiakMD avatar May 23 '24 14:05 kosiakMD