confluentinc / ksqldb-graphql

Node.js GraphQL integration for ksqlDB
https://ksqldb.io/
Other
57 stars 15 forks source link

"This endpoint is only available when using HTTP2" #11

Open hamzadahbi opened 4 years ago

hamzadahbi commented 4 years ago

I'm trying to launch the RIDESHARE project with my own ksqldb server, but I'm running through this error whenever I try to test a query through the playground on the server side {"error": {"name": "Error", "message": "This endpoint is only available when using HTTP2"} } Also on the client side, I can't see the cars while getting this error client. t's: 545 WebSocket connection to 'ws://ec2-54-187-136-198.us-west-2.compute.amazonaws.com:3010/graphql' failed: Error in connection establishment: net:: ERR_CONNECTION_REFUSED . I should mention that all the data gets saved in the Ksqldb server

stevecalvert commented 4 years ago

It looks like ksqldb-graphql is dependent on KLIP-15, which is still marked as a Proposal and has alas not been progressed since Feb 2020. @purplefox, any news on getting this merged? MEanwhile, is there an alternative solution for a GraphQL / ksqlDB integration?

purplefox commented 4 years ago

KLIP-15 was completed and merged some time back.

purplefox commented 4 years ago

"This endpoint is only available when using HTTP2"

Seems like the ride share app is not using HTTP2. /cc @colinhicks

stevecalvert commented 4 years ago

Thanks, @purplefox, I was misled by the KLIP directory not being up to date. Runing Wireshark on localhost, it appears Rideshare graphql server (acting as client to ksqlDB) does attempt HTTP/2 with a MAGIC+SETTINGS packet:

HyperText Transfer Protocol 2
    Stream: Magic
        Magic: PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n
    Stream: SETTINGS, Stream ID: 0, Length 0
        Length: 0
        Type: SETTINGS (4)
        Flags: 0x00
            .... ...0 = ACK: False
            0000 000. = Unused: 0x00
        0... .... .... .... .... .... .... .... = Reserved: 0x0
        .000 0000 0000 0000 0000 0000 0000 0000 = Stream Identifier: 0

and gets back a HTTP/1.1 426 Upgrade Required from ksqlDB

HTTP/1.1 426 Upgrade Required
Content-Type: text/html;charset=iso-8859-1
Content-Length: 59
Connection: close

<h1>Bad Message 426</h1><pre>reason: Upgrade Required</pre>

at which point Rideshare just replies with an HTTP/2 GOAWAY and the HTTP/2 connection does not proceed although the server does go on to successfully interrogate ksqldb-server on localhost:8088 under HTTP/1.1 to extract the stream/table schemas. The Rideshare server log reports:

Error [ERR_HTTP2_ERROR]: Protocol error
    at Http2Session.onSessionInternalError (internal/http2/core.js:747:26) {
  code: 'ERR_HTTP2_ERROR',
  errno: -505
}

Any GraphQL query, such as below from the frontend always fails with the following response:

{
  "errors": [
    {
      "message": "The session has been destroyed",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "PAGEVIEWS_FEMALE"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "code": "ERR_HTTP2_INVALID_SESSION",
          "stacktrace": [
            "Error [ERR_HTTP2_INVALID_SESSION]: The session has been destroyed",
            "    at ClientHttp2Session.request (internal/http2/core.js:1600:13)",
            "    at AsyncIteratorQueryStream.initQueryStream (/Users/steve/vsys/ksqldb-graphql/packages/ksqldb-client/src/queryStream.ts:74:33)",
            "    at AsyncIteratorQueryStream.[Symbol.asyncIterator] (/Users/steve/vsys/ksqldb-graphql/packages/ksqldb-client/src/queryStream.ts:112:50)",
            "    at __asyncValues (/Users/steve/vsys/ksqldb-graphql/packages/ksqldb-graphql/src/resolvers.ts:14:18)",
            "    at ResolverGenerator.<anonymous> (/Users/steve/vsys/ksqldb-graphql/packages/ksqldb-graphql/src/resolvers.ts:186:29)",
            "    at Generator.next (<anonymous>)",
            "    at /Users/steve/vsys/ksqldb-graphql/packages/ksqldb-graphql/src/resolvers.ts:8:71",
            "    at new Promise (<anonymous>)",
            "    at __awaiter (/Users/steve/vsys/ksqldb-graphql/packages/ksqldb-graphql/src/resolvers.ts:4:12)",
            "    at ResolverGenerator.handleQueryResolve (/Users/steve/vsys/ksqldb-graphql/packages/ksqldb-graphql/src/resolvers.ts:180:97)"
          ]
        }
      }
    }
  ],
  "data": {
    "PAGEVIEWS_FEMALE": null
  }
}

I'm runnining ksqldb-graphql server against Confluent Docker ksqlDB stack, all on macOS localhost.