graphql-mesh icon indicating copy to clipboard operation
graphql-mesh copied to clipboard

Fork number in serve config is ignored

Open SGudbrandsson opened this issue 9 months ago • 2 comments

Issue workflow progress

Progress of the issue based on the Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.

  • [ ] 2. A failing test has been provided
  • [ ] 3. A local solution has been provided
  • [ ] 4. A pull request is pending review

Describe the bug

When we configure GraphQL mesh fork count through .meshrc.yml in the serve part of the config in production, GraphQL Mesh will ignore that.

This means that this part of the documentation and config is out-of-date: https://github.com/Urigo/graphql-mesh/blob/900a5c53dfdfe66f1d4a113ec118c00d527b0ccf/packages/types/src/config.ts#L78

image image

To Reproduce Steps to reproduce the behavior:

Create a .meshrc.yml file with this config:

serve:
  fork: 1
  playgroundTitle: "Example Mesh"
  playground: true
  browser: false

Build the mesh and run node with production enabled on a computer with 4 cores - Mesh will spawn 8 forks.

Expected behavior

I expected GraphQL mesh to obey the configuration in .meshrc.yml

Environment:

  • OS:
  • @graphql-mesh/...: 0.95.4
  • NodeJS:

Additional context

Reading the forking code, I found out that to set the desired quantity of forks, you need to set the environment variable FORK to the number of workers/forks you want.

SGudbrandsson avatar Oct 04 '23 11:10 SGudbrandsson

@graphql-mesh/...: 0.95.4

CLI controls this logic, and we don't have 0.95.x version for CLI yet. Could you check the version again?

ardatan avatar Oct 11 '23 13:10 ardatan

It's version 0.87.8.

Here's the full package.json

{
  "name": "mesh",
  "packageManager": "[email protected]",
  "scripts": {
    "dev": "mesh dev",
    "build": "mesh build",
    "validate": "mesh validate",
    "start": "mesh start",
    "start-prod": "./scripts/restore-mesh.sh && mesh start"
  },
  "dependencies": {
    "@graphql-hive/cli": "^0.29.0",
    "@graphql-mesh/cli": "0.87.8",
    "@graphql-mesh/cross-helpers": "0.4.0",
    "@graphql-mesh/graphql": "0.95.4",
    "@graphql-mesh/http": "0.96.9",
    "@graphql-mesh/openapi": "0.95.4",
    "@graphql-mesh/plugin-hive": "^0.95.7",
    "@graphql-mesh/runtime": "0.96.8",
    "@graphql-mesh/store": "0.95.4",
    "@graphql-mesh/transform-filter-schema": "0.95.4",
    "@graphql-mesh/transform-prefix": "0.95.4",
    "@graphql-mesh/transform-rename": "0.95.4",
    "@graphql-mesh/types": "0.95.4",
    "@graphql-mesh/utils": "0.95.4",
    "@graphql-tools/executor-http": "^1.0.0",
    "graphql": "16.8.1",
    "tslib": "2.6.2"
  },
  "devDependencies": {
    "dotenv": "16.3.1"
  },
  "resolutions": {
    "@graphql-mesh/[email protected]": "patch:@graphql-mesh/transform-prefix@npm%3A0.95.4#./.yarn/patches/@graphql-mesh-transform-prefix-npm-0.95.4-a6d20dad60.patch",
    "@graphql-mesh/[email protected]": "patch:@graphql-mesh/types@npm%3A0.95.4#./.yarn/patches/@graphql-mesh-types-npm-0.95.4-6300b6b38f.patch",
    "@graphql-mesh/types@^0.95.4": "patch:@graphql-mesh/types@npm%3A0.95.4#./.yarn/patches/@graphql-mesh-types-npm-0.95.4-6300b6b38f.patch",
    "@graphql-tools/[email protected]": "patch:@graphql-tools/executor-http@npm%3A1.0.2#./.yarn/patches/@graphql-tools-executor-http-npm-1.0.2-21b40422b1.patch",
    "@graphql-tools/executor-http@^1.0.0": "patch:@graphql-tools/executor-http@npm%3A1.0.2#./.yarn/patches/@graphql-tools-executor-http-npm-1.0.2-21b40422b1.patch"
  }
}

SGudbrandsson avatar Oct 11 '23 14:10 SGudbrandsson