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

NoSuchMethodError using AkkaHttpBackend #1773

Open
jonathan-neufeld-asurion opened this issue Mar 16, 2023 · 1 comment
Open

NoSuchMethodError using AkkaHttpBackend #1773

jonathan-neufeld-asurion opened this issue Mar 16, 2023 · 1 comment

Comments

@jonathan-neufeld-asurion
Copy link

jonathan-neufeld-asurion commented Mar 16, 2023

java.lang.NoSuchMethodError: sttp.model.Uri.host()Ljava/lang/String;
	at sttp.client.akkahttp.AkkaHttpBackend.connectionSettings(AkkaHttpBackend.scala:177)
	at sttp.client.akkahttp.AkkaHttpBackend.$anonfun$send$3(AkkaHttpBackend.scala:88)
	at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307)
	at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41)
	at scala.concurrent.impl.CallbackRunnable.run$$$capture(Promise.scala:64)

I've traced this to a binary incompatibility introduced by sttp.model:core @ v1.3.4, there does not appear to be an updated version of akka-http-backend to compensate though.

This is because actual host method on Uri returns an Option[String] as of v.1.3.4.

Method where the issue is raised from:

  private def connectionSettings(r: Request[_, _]): ConnectionPoolSettings = {
    val connectionPoolSettingsWithProxy = opts.proxy match {
      case Some(p) if !p.ignoreProxy(r.uri.host) =>
        val clientTransport = p.auth match {
          case Some(proxyAuth) =>
            ClientTransport.httpsProxy(
              p.inetSocketAddress,
              BasicHttpCredentials(proxyAuth.username, proxyAuth.password)
            )
          case None => ClientTransport.httpsProxy(p.inetSocketAddress)
        }
        connectionPoolSettings.withTransport(clientTransport)
      case _ => connectionPoolSettings
    }
    connectionPoolSettingsWithProxy
      .withUpdatedConnectionSettings(_.withIdleTimeout(r.options.readTimeout))
  }
@adamw
Copy link
Member

adamw commented Mar 16, 2023

Which versions of sttp & akka are you using? What kind of entries do you have in your build file?

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

2 participants