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

Run subscriptions like queries with IDE plugins #5745

Closed
damianpetla opened this issue Mar 20, 2024 · 4 comments
Closed

Run subscriptions like queries with IDE plugins #5745

damianpetla opened this issue Mar 20, 2024 · 4 comments

Comments

@damianpetla
Copy link

damianpetla commented Mar 20, 2024

Use case

Right now we cannot run subscriptions with IDE plugin. It returns error

{
  "errors": [
    {
      "message": "subscriptions are not supported over HTTP, use websockets instead",
      "extensions": {
        "path": "$",
        "code": "unexpected-payload"
      }
    }
  ]
}

Every time I need to test it I manually change it to query and then run.

Describe the solution you'd like

Would be nice if plugin could call it like query under the hood, maybe with some warning saying it was transformed to query on the fly.

@BoD
Copy link
Contributor

BoD commented Mar 20, 2024

Thank you for reporting this!

A way to execute subscriptions in the IDE would be nice, however the challenge is that the underlying protocol for subscriptions is not part of the GraphQL spec, and therefore several protocol exist depending on the server (several WebSocket subprotocols, subscriptions over HTTP, etc.) - so we would need a way to configure the plugin with that information.

The idea you suggest to transform the document into a query is interesting, but wouldn't work in the general case - it would only work for schemas that have the same fields in their Query and Subscription types. I am not sure how common this is.

Side note: this part of the plugin is actually provided by the GraphQL plugin, which Apollo depends on - it may make sense to open an issue there.

@damianpetla
Copy link
Author

thanks @BoD I have reported it there JetBrains/js-graphql-intellij-plugin#708

Copy link
Contributor

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Kotlin usage and allow us to serve you better.

@kkarkal
Copy link

kkarkal commented Oct 9, 2024

This will be a good feature for the IDE's, Currently we are only able to run queries and mutations, Subscriptions would be great to run.

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

No branches or pull requests

3 participants