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

Serving GraphQL API with QuickAdapter no longer works with zio-http-v3.0.0-RC10 #2387

Closed
tymm opened this issue Sep 3, 2024 · 4 comments
Closed

Comments

@tymm
Copy link

tymm commented Sep 3, 2024

I'm following the recipe from https://ghostdogpr.github.io/caliban/docs/adapters.html#usage to serve my GraphQL api via zio-http.

val api: GraphQL[Any] = ???

for {
    handlers  <- api.handlers
    // Alternatively, without imported syntax:
    handlers2 <- api.interpreter.map(QuickAdapter(_).handlers)
    // Creates a handler which serves the GraphiQL API from CDN
    graphiql = GraphiQLHandler.handler(apiPath = "/api/graphql", graphiqlPath = "/graphiql")
    app = Routes(
            Method.ANY / "api" / "graphql"     -> handlers.api,
            Method.GET / "graphiql"            -> graphiql,
            Method.POST / "upload" / "graphql" -> handlers.upload
            // Add more routes, apply middleware, etc.
          )
    _ <- app.serve[Any].provide(Server.defaultWithPort(8080))
} yield ()

The above worked with zio-http-v3.0.0-RC9 but no longer works with zio-http-v3.0.0-RC10 where http://localhost:8080/api/graphql returns a HTTP status code of 500.

@kyri-petrou
Copy link
Collaborator

Hi @tymm thanks for reporting. This is an issue with ZIO-HTTP breaking binary compatibility between RC9 and RC10.

Please refer to #2383 for more info. In short, we're waiting for v3.0.0 to be released (which should be next week) so that we break binary compatibility on our end just once

@tymm tymm closed this as completed Sep 3, 2024
@tymm
Copy link
Author

tymm commented Sep 25, 2024

@kyri-petrou I updated to zio-http 3.0.0 and Caliban 2.9.0 but somehow the above problems persist.

@ghostdogpr
Copy link
Owner

Are you sure the versions are correct? You can check it with the evicted sbt task. If yes, can you provide more details on the error or ideally a reproducer? Our test suite is using these versions.

@tymm
Copy link
Author

tymm commented Sep 25, 2024

The correct versions are selected but after trying it out in a minimal example project things work with the new versions. So it must be something else. Thanks!

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