Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example returns product price and weight as null when query productById(id: '123') at localhost:4000 #13

Open
rackuka opened this issue Apr 1, 2021 · 5 comments

Comments

@rackuka
Copy link

rackuka commented Apr 1, 2021

QUERY:

{
productById(id: "123") {
id
name
price
weight
}
}

RESPONSE:

{
"data": {
"productById": {
"id": "123",
"name": "name from transformed service",
"price": null,
"weight": null
}
}
}

Steps to reprouce:

  1. git clone from your repository.
  2. npm install
  3. npm fix audit --legacy-peer-deps
  4. npm run example:watch
  5. In browser go to localhost:4000 and run the query above
@jamesjenkinsjr
Copy link

@0xR any chance you have a moment to take a look at this? I suspect it might be part of the reason another repo using your work as a dependency is having issues (@graphql-mesh/transform-federation)

@0xR
Copy link
Owner

0xR commented Jun 4, 2021

Did something change? Does the issue occur for older versions of this project?

@rackuka
Copy link
Author

rackuka commented Jun 4, 2021

I was able to reproduce the issue on tags 2.2.0, 2.1.0, 2.0.1 by checking out corresponding version from github. Did not go to older versions though.

@jamesjenkinsjr
Copy link

Tag 1.0.0 also does not blend the two values for productById but it does appear to blend the values when querying findProduct:

query foo {
  productById(id: "123") {
    id
    weight
    name
    price    
  }
}
# Result
{
  "data": {
    "productById": {
      "id": "123",
      "weight": null,
      "name": "name from transformed service",
      "price": null
    }
  }
}

vs.

query foo2 {
  findProduct {
    id
    weight
    name
    price
  }
}
# Result
{
  "data": {
    "findProduct": {
      "id": "123",
      "weight": 100,
      "name": "name from transformed service",
      "price": 899
    }
  }
}

In fact, it seems that through tag 2.1.0 findProduct is at least blending the values from both services but on tag 2.2.0 attempting to query findProduct with any field that is sourced from the transformed-server's Product type results in an error:

TypeError: list.map is not a function",
            "    at resolveExternalList (/Users/me/Development/graphql-transform-federation/dist/delegate/src/resolveExternalValue.js:57:17)

@janhelleman
Copy link

For the list.map error, see #5 @jamesjenkinsjr. You need to set a returnType in the delegateToSchema

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants