wundergraph / cosmo

The open-source solution to building, maintaining, and collaborating on GraphQL Federation at Scale. The alternative to Apollo Studio and GraphOS.
https://cosmo-docs.wundergraph.com/
Apache License 2.0
679 stars 96 forks source link

In the new version BatchEntityFetch stopped working adequately with some variation of composite key/resolvable: false/sharable #1184

Open flymedllva opened 4 days ago

flymedllva commented 4 days ago

Component(s)

router

Component version

0.110.1

wgc version

0.64.1

controlplane version

-

router version

0.110.1

What happened?

Description

In the new version BatchEntityFetch stopped working adequately with some variation of composite keys, resolvable false, sharable

Steps to Reproduce

Use the schema I sent you in the mail https://github.com/wundergraph/cosmo/issues/959#issuecomment-2258868305

Run Query:

query TestidentificationReports {
  identificationReports(
    filter: {
      idIn: "123456789"
    }
    page: 1
    perPage: 1
    sort: ORDER_CREATED_AT
    sortDirection: DESC
  ) {
    items {
      event {
        documents {
          document {
            payeeAmount
          }
        }
      }
    }
  }
}

Expected Result

Working Query as in the old version of cosmo or apollo.

Actual Result

{
  "message": "expected at least one definition, found }",
  "extensions": {
    "code": "GRAPHQL_PARSE_FAILED"
  }
}

Also, the Query Plan does not always work, probably for the same reason Sometimes subgraphs from cosmo receive broken JSONs

By doing a variation Query I achieved a working plan and saw there this Screenshot 2024-09-18 at 11 11 00

Environment information

Environment

OS: (e.g., "Ubuntu 20.04") macOS Package Manager: pnpm, npm, yarn, etc pnpm Compiler(if manually compiled): (e.g., "go 14.2") go version go1.22.5 darwin/arm64

Router configuration

version: "1"

# General router options
graph:
  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

# 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

\nDownstream errors:\n1. Subgraph error with Message: expected at least one definition, found }, Extension Code: GRAPHQL_PARSE_FAILED.

Additional context

No response

github-actions[bot] commented 4 days ago

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.

Aenimus commented 3 days ago

Hi @flymedllva,

Which version appears to break this? What is the last working version?

Thanks

flymedllva commented 3 days ago

@Aenimus

I tried different versions of the router and got the following

router@0.111.1 BROKEN router@0.107.4 BROKEN

e13c021dc5a5dbf1875005da583044e9875de56d BROKEN 0fe2cbaa72fa7ba5dbbf97c1e95615f29f13af1f BROKEN

router@0.107.3 and down OK

d219a6eed1548487b9b31598079da7bfd7b41117 OK

router@0.107.2 and down OK router@0.107.1 and down OK

I.e., this MR broke download: https://github.com/wundergraph/cosmo/pull/1092

Aenimus commented 3 days ago

Hi @flymedllva

Please provide the query plans from the working version and non-working versions.

If this information is sensitive, please join our community Discord, ping me, and we'll open a private correspondence where you can share safely.