wundergraph/cosmo

Router does not work correctly with input dublicate nested types

flymedllva opened this issue · 3 comments

Component(s)

router, controlplane, composition, cli

Component version

v0.78.0

wgc version

0.49.1

controlplane version

v0.80.0

router version

v0.78.0

What happened?

Description

We have a large 15 megabyte supergraph running Apollo, we tried to run Cosmo on it and got a lot of input related errors.
We tried to reproduce them, there seems to be a problem with the

  • with the same inputs nested in inputs
  • there is an assumption that this applies not only to nested inputs

Steps to Reproduce

I've put together a minimal example that the latest version of the router doesn't work with
https://github.com/flymedllva/cosmo-input-with-dublicate-nested-type-does-not-work

query Test {
    test(filter: {b: null})
}

or

query Test($filter: TestFilter) {
    test(filter: $filter)
}

and variables

{
    "filter": {"b": null}
}

Expected Result

{
  "data": {
    "test": 666
  }
}

Actual Result

{
  "errors": [
    {
      "message": "Failed to fetch from Subgraph '0' at path 'query'.",
      "extensions": {
        "errors": [
          {
            "message": "could not render fetch input",
            "path": []
          }
        ]
      }
    }
  ],
  "data": null,
  "extensions": {
    "trace": {
      "info": {
        "trace_start_time": "2024-04-03T18:22:51+03:00",
        "trace_start_unix": 1712157771,
        "parse_stats": {
          "duration_nanoseconds": 344291,
          "duration_pretty": "344.291µs",
          "duration_since_start_nanoseconds": 160625,
          "duration_since_start_pretty": "160.625µs"
        },
        "normalize_stats": {
          "duration_nanoseconds": 586500,
          "duration_pretty": "586.5µs",
          "duration_since_start_nanoseconds": 526291,
          "duration_since_start_pretty": "526.291µs"
        },
        "validate_stats": {
          "duration_nanoseconds": 93541,
          "duration_pretty": "93.541µs",
          "duration_since_start_nanoseconds": 1124750,
          "duration_since_start_pretty": "1.12475ms"
        },
        "planner_stats": {
          "duration_nanoseconds": 7581916,
          "duration_pretty": "7.581916ms",
          "duration_since_start_nanoseconds": 1218875,
          "duration_since_start_pretty": "1.218875ms"
        }
      },
      "fetch": {
        "id": "7d5fe3fb-0da8-4a75-b129-b414fc2193ac",
        "type": "single",
        "data_source_id": "0",
        "datasource_load_trace": {
          "raw_input_data": {},
          "single_flight_used": false,
          "single_flight_shared_response": false,
          "load_skipped": false
        }
      },
      "node_type": "object",
      "nullable": true,
      "fields": [
        {
          "name": "test",
          "value": {
            "node_type": "integer",
            "path": [
              "test"
            ]
          },
          "parent_type_names": [
            "Query"
          ],
          "named_type": "Int",
          "data_source_ids": [
            "0"
          ]
        }
      ]
    }
  }
}

Environment information

Environment

OS: 14.4 (23E214)
Package Manager: npm
Compiler(if manually compiled): go version go1.22.1 darwin/arm64

Router configuration

version: "1"

# General router options
graph:
  name: "production"
  token: ""

log_level: "info"
listen_addr: "localhost:3002"
playground_enabled: true
introspection_enabled: true
json_log: true
shutdown_delay: 15s
grace_period: 20s
poll_interval: 10s
health_check_path: "/health"
readiness_check_path: "/health/ready"
liveness_check_path: "/health/live"
router_config_path: "config.json"

cors:
  allow_origins: ["*"]
  allow_methods:
    - HEAD
    - GET
    - POST
  allow_headers:
    - Origin
    - Content-Length
    - Content-Type
  allow_credentials: true
  max_age_minutes: 5m

# Config for custom modules   
# See "https://cosmo-docs.wundergraph.com/router/custom-modules" for more information   
modules:
  myModule:
    # Arbitrary values, unmarshalled by the module
    value: 1

Router execution config

No response

Log output

No response

Additional context

Screenshot 2024-04-03 at 18 32 47
Screenshot 2024-04-03 at 18 34 03
Screenshot 2024-04-03 at 18 33 30

WunderGraph commits fully to Open Source and we want to make sure that we can help you as fast as possible.
The roadmap is driven by our customers and we have to prioritize issues that are important to them.
You can influence the priority by becoming a customer. Please contact us here.

Hi @flymedllva

I can confirm there is an issue. We'll work on a fix. I'll keep you updated where possible.

Hi @flymedllva,

This should be fixed with router 0.82.0.
https://github.com/wundergraph/cosmo/compare/router@0.81.0...router@0.82.0

Please let us know how it goes.

Thanks again for the report.