zio-grpc icon indicating copy to clipboard operation
zio-grpc copied to clipboard

Compile Error for Missing Bindable Service Implicit

Open nsadeh opened this issue 3 years ago • 8 comments

Description:

I am unable to compile a simple gRPC server running on ZIO gRPC because it complains of missing implicit arguments even though I think I imported them. Here is what I did:

  1. I followed the directions for plugins/dependencies on the website.
  2. For my service, I generated a ZManaged with the type signature ZManaged[Any, Nothing, ZioMyService.ZMyService[ZEnv, Any]]
  3. I added the service to services using addManaged
  4. At this point I see no compiler highlighting in IntelliJ for any kind of missing arguments
  5. When I run sbt compile I get the following error:

could not find implicit value for parameter bs: scalapb.zio_grpc.ZBindableService[ZioMyService.ZMyService[zio.ZEnv,Any]]

NOTE: I imported

import ZioMyService.ZMyService.genericBindable\n import scalapb.zio_grpc.CanBind.canBindAny

initially when there was a highlight. The import resolved the highlight but the compiler still cannot compile (or run) my server.

This uses versions:

  • sbt-protoc 1.0.2
  • zio-grpc-codegen 0.5.0
  • Scala 2.13.6
  • SBT 1.5.5
  • JDK Azul Zulu 11

nsadeh avatar Aug 31 '21 03:08 nsadeh

Update: I was able to get this to compile by using a ZIO instead of ZManaged but I still think this warrants looking at.

nsadeh avatar Aug 31 '21 03:08 nsadeh

Thanks for reporting! Looks like something that should be fixed. Could you provide a minimal example of this error through a PR that adds a unit test under the e2e directory?

thesamet avatar Aug 31 '21 04:08 thesamet

I would like to - I think I can get to it on Wednesday.

nsadeh avatar Aug 31 '21 04:08 nsadeh

Although since this is a compile issue rather than a runtime issue, I don't know if the unit test is needed? Should I just create a ServerMain example?

nsadeh avatar Aug 31 '21 04:08 nsadeh

Yes, we use tests also for compile-time, to make sure the APIs work as intended, and implicits can be found in the scenarios we want to support. This also helps preventing regressions for the use cases under test.

thesamet avatar Aug 31 '21 06:08 thesamet

However, feel free to provide a reproducible example in any way that is convenient for you and I'll take a look and move it around as needed.

thesamet avatar Aug 31 '21 06:08 thesamet

Hey @thesamet I am still tracking this just got a bit behind :)

nsadeh avatar Sep 06 '21 19:09 nsadeh

@nsadeh does #301 fix it for you?

tuleism avatar Sep 21 '21 09:09 tuleism