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

Subscriptions return null values #4669

Closed
2 of 4 tasks
kantum opened this issue Oct 12, 2022 · 3 comments
Closed
2 of 4 tasks

Subscriptions return null values #4669

kantum opened this issue Oct 12, 2022 · 3 comments

Comments

@kantum
Copy link

kantum commented Oct 12, 2022

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

I need to do subscription from callbacks in an openapi yaml file.

So I tryied this example: openapi-subscriptions which by the way is broken on codesandbox:

error dotenv@16.0.3: The engine "node" is incompatible with this module. Expected version ">=12". Got "10.24.1"
error Found incompatible module.

I managed to make it work, but graphql-mesh is now replacing my values with null.

Then I tried the json-schema-subscriptions examples and had similar problem.

In debug mode, I can see the value being received by graphql-mesh:

🐛 🕸️  Mesh - HTTP Received webhook request for /webhooks/todo_added {"id":0,"name":"foo","content":"bar"}
🐛 🕸️  Mesh - Example - Subscription.todoAdded Received  {"id":0,"name":"foo","content":"bar"}  from  webhook:post:/webhooks/todo_added

But in GraphiQL or any other client I get:

{
  "data": {
    "todoAdded": {
      "id": null,
      "name": null,
      "content": null
    }
  }
}

To Reproduce
The bug is reproducible with official example of schema subscription

  1. Open the link with google chrome (firefox is kind of broken with codesandbox)
  2. Subscribe:
    subscription TodoAdded {
        todoAdded {
          id
          name
          content
        }
    }
  3. Add a todo:
    mutation Mutation($input: mutationInput_addTodo_input_Input) {
      addTodo(input: $input) {
        id
      }
    }
    {
    "input": {
       "name": "foo",
       "content": "bar"
     }
    }
  4. See the result of the subscription
    {
     "data": {
       "todoAdded": {
         "id": null,
         "name": null,
         "content": null
       }
     }
    }
  5. Enjoy the problem

You can add DEBUG=1 in the mesh:dev script in packages.json to see the data being received by graphql-mesh.

Expected behavior
Subscription should give values not null

{
  "data": {
    "todoAdded": {
      "id": "ad88b3e0-3f86-4401-9354-c6aedaa6d820",
      "name": "foo",
      "content": "bar"
    }
  }
}

Environment:

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

Additional context

@theguild-bot theguild-bot mentioned this issue Oct 13, 2022
@RahulSadaphalXebia
Copy link

@kantum Did you get any solution for above subscription issue?
because I am also getting the same error. Please let me know if you find any solution.

@kantum
Copy link
Author

kantum commented Oct 15, 2022

@RahulSadaphalXebia No, I think it's internal to graphql-mesh, didn't have time to investigate.

I guess by testing older versions of graphql-mesh it might work as documented. Then by incrementing version you may find where it comes from.

@ardatan
Copy link
Owner

ardatan commented Oct 18, 2022

Fixed via 2365f89

@ardatan ardatan closed this as completed Oct 18, 2022
@theguild-bot theguild-bot mentioned this issue Sep 28, 2023
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

3 participants