finch
finch copied to clipboard
Incompatible versions of jackson with other libraries
In the same project I have finch (0.32.1), zio-kafka (0.14.0) and awssdk (2.15.78), all of which depend on a different version of jackson. Digging the code up a little, I found out finch checks that the version it depends on (through finagle) is exactly the same version used in the build, otherwise it throws an exception on startup:
com.fasterxml.jackson.databind.JsonMappingException: Scala module 2.9.10 requires Jackson Databind version >= 2.9.0 and < 2.10.0
Is there a way to work around this? I don't quite grasp why finch has to check jackson's version, but is there a way to bypass this? Will a later finch release depending on a newer finagle fix this?
It's coming from twitter-server of finagle-stats if I recall. I suggest to update those dependencies, Finch should work with newer Finagle just fine.
Not quite (although twitter-server does use it a lot), Finagle uses jackson for ToggleMaps (which does get loaded by finagle-http). Finch does not use it directly so pinning to the version of Jackson that Finagle is using might work.
We're not directly checking the versions in Finch or Finagle. It happens inside jackson itself: https://github.com/FasterXML/jackson-module-scala/blob/5293009454ea7fbe37712de4e4191e1ebfd59c31/src/main/scala/com/fasterxml/jackson/module/scala/JacksonModule.scala#L53. But it does stop Finagle servers from loading if that check fails, so its not ideal if other things are bringing another version in.
You might also be able to manually set a finagle version higher than what we use in that version of finch, although Finagle does not really have any binary compatibility guarantees.
So your recommendation would be to wait for the next Finch release, @rpless? Is there a release planned for the near future?
Its not ideal but that is a possible solution, I don't think we currently have an ETA on the next release.
Another option might be to try and downgrade the version of jackson-module-scala that you rely on to the version that Finagle is using. One way to do this would be with the dependencyOverrides directive in sbt. Even with that you may wind up with an issue with your other dependencies versions of jackson clashing.