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

Fails to parse valid Apollo subscription messages which contain extensions field #75

Open
sekoyo opened this issue Jul 9, 2020 · 2 comments
Labels

Comments

@sekoyo
Copy link

sekoyo commented Jul 9, 2020

Describe the bug

Apollo sends an extensions: {} field with subscription queries like so:

{
  "id": "1",
  "type": "start",
  "payload": {
    "variables": {
      "_v0_symbol": "btcusd"
    },
    "extensions": {},
    "operationName": null,
    "query": "subscription ($_v0_symbol: String) {  ticker(symbol: $_v0_symbol) {    average    createdAtTimestamp  }}"
  }
}

Unless extensions is removed or changed to undefined then the java graphql server refuses to parse the valid message. In Micronaut v1 it threw a JSON parse exeption, in Micronaut v2 it doesn't throw but a response is not sent unless extensions is undefined or not present.

To Reproduce

Send a query with extensions: {} for example:

{
  "id": "1",
  "type": "start",
  "payload": {
    "variables": {
      "marketId": "BTCUSD"
    },
    "extensions": {},
    "operationName": "TickerForTradeSubscription",
    "query": "subscription TickerForTradeSubscription($marketId: String!) {\n  ticker(symbol: $marketId) {\n    symbol\n    open\n    low\n    high\n    baseVolume\n    bestBid\n    bestAsk\n    last\n    lastTradeSize\n    createdAtTimestamp\n    __typename\n  }\n}\n"
  }
}

Environment Information

  • Operating System: MacOS & Docker
  • Micronaut Version: v2
  • JDK Version: 11
@ilopmar
Copy link
Contributor

ilopmar commented Jul 13, 2020

Can you please share an app that reproduces the issue?

@ilopmar ilopmar added status: awaiting feedback type: bug Something isn't working labels Jul 13, 2020
@gklijs
Copy link
Contributor

gklijs commented Feb 10, 2021

Seems like they should/could be added to https://github.com/micronaut-projects/micronaut-graphql/blob/master/graphql/src/main/java/io/micronaut/configuration/graphql/GraphQLRequestBody.java but it's a bit lame to just make it a valid object, and further ignore extensions.

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

No branches or pull requests

3 participants