Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 00:59

    mergify[bot] on fs2-core-3.2.9

    (compare)

  • 00:59
    mergify[bot] closed #1484
  • 00:59

    mergify[bot] on master

    Update fs2-core, fs2-io, ... to… Merge pull request #1484 from s… (compare)

  • 00:59

    mergify[bot] on jaeger-client-1.8.1

    (compare)

  • 00:59
    mergify[bot] closed #1485
  • 00:59

    mergify[bot] on master

    Update jaeger-client to 1.8.1 Merge pull request #1485 from s… (compare)

  • 00:29
    mergify[bot] labeled #1485
  • 00:29
    mergify[bot] labeled #1484
  • 00:29
    softwaremill-ci opened #1485
  • 00:29

    softwaremill-ci on jaeger-client-1.8.1

    Update jaeger-client to 1.8.1 (compare)

  • 00:29
    softwaremill-ci opened #1484
  • 00:29

    softwaremill-ci on fs2-core-3.2.9

    Update fs2-core, fs2-io, ... to… (compare)

  • Jul 01 15:44
    LeeTibbert commented #1481
  • Jul 01 14:15
    Pask423 synchronize #1482
  • Jul 01 14:15

    Pask423 on zio-package-sharing

    Fix docs compilation (compare)

  • Jul 01 13:17
    Pask423 synchronize #1469
  • Jul 01 13:17

    Pask423 on zio-2.0.0

    Remove redundant clock layer (compare)

  • Jul 01 09:24
    k3rnL commented #1481
  • Jul 01 06:48
    LeeTibbert commented #1481
  • Jul 01 06:38
    LeeTibbert commented #1481
ylaurent
@ylaurent

Hello, I am trying client3 with zio (scala 2.13.3 and zio 1.0.3, sttp 3.0.0-RC5), following the example here https://sttp.softwaremill.com/en/latest/examples.html (GET and parse JSON using the ZIO async-http-client backend and circe), I get at runtime

[info]   Fiber failed.
[info]   An unchecked error was produced.
[info]   java.lang.Error: Defect in zio.Has: Set(SttpBackend[=λ %2:0 → ZIO[-Any,+Throwable,+2:0],+{ZioStreams & package::WebSockets}]) statically known to be contained within the environment are missing
[info]       at zio.Has$HasSyntax$.prune$extension(Has.scala:197)
[info]       at zio.Has$HasSyntax$.union$extension(Has.scala:209)
[info]       at zio.Has$Union$$anon$2.union(Has.scala:91)
[info]       at zio.Has$Union$$anon$2.union(Has.scala:89)

Anything I am missing ? when I am not using layer, and just directly the backend its working properly.

9 replies
Denis Mikhaylov
@notxcain
2 replies
Lorenzo Gabriele
@lolgab
Hi everyone :)
Are you interested in a upickle/ujson integration like the circe one? Can I submit a PR?
4 replies
user753
@user753
hi. I would like to use okhttp backend with cats IO. Is it possible to transform SttpBackend[Future, Nothing, WebSocketHandler] to SttpBackend[IO, Nothing, WebSocketHandler] or separate backend should be created?
1 reply
Pavel Yurgin
@payurgin
I trying to implement sttp backend for prometeus metrics.
I want to report statusCode as one of the label for metric. But I noticed that if request fails with DeserializationError, all metadata of response (headers, status code and other) will be lost.
@adamw WDYT about adding optional ResponseMetadata to ResponseError ?
2 replies
Leszek Gruchała
@leszekgruchala
Hi. I am using STTP with ZIO. It's a bit unclear to me if STTP calls should be wrapped with effectBlocking. I think not as otherwise Blocking would be simply required by sttp-zio integration. I guess STTP has it's own execution context, but maybe it's still good to tell ZIO this is a blocking operation?
12 replies
Vasily Shiyan
@xicmiah
How do you ensure that streams close when using v3 asStreamUnsafe? Obviously this is backend/stream-specific, but some hints would help.
For example in proxy-ish scenario, using httpclient-backend-fs2, get IO[Stream[IO, T]] from sttp, add some in-flight transformations, stream results in http response via http4s. I think this scenario cannot be expressed with safe asStream.
2 replies
Anton Kulaga
@antonkulaga
I am having issues with sending requests to download files on FTP via syncronius backend, could you suggest what is the recommended way of downloading files?
2 replies
almoehi
@almoehi
Hi - I'm trying to get a minimal working example of sttp3 (akka backend) + websocket + asWebSocketStreamAlways. The client is connecting but it's not sending or receiving anything. This is how I'm using it right now - what am I missing here ?
def webSocketFramePipe: Flow[WebSocketFrame.Data[_], WebSocketFrame, NotUsed] = Flow[WebSocketFrame.Data[_]].map{
    case o @ WebSocketFrame.Text(str, _, _) =>
      println(s"received string: $str")
    case other =>
      println(s"received other: $other")
      other
}

val inputSrc: Source[ByteString, Any] = ... // ie Seq("test1", "test")

basicRequest
.get(uri)
.streamBody(AkkaStreams)(inputSrc)
.response(asWebSocketStreamAlways(AkkaStreams)(webSocketFramePipe))
.send(backend)
.onComplete(_ => backend.close())
5 replies
Binh Nguyen
@ngbinh
Hi, anyone know if OpenAPI generator https://sttp.softwaremill.com/en/latest/openapi.html work with sttp 3.X? I tried the example repo https://github.com/softwaremill/sttp-openapi-example but looks like it only work with sttp 2.X
1 reply
Bruno Campos
@brucampos88_twitter

HI… I am trying to use PrometheusBackend with Cats backend but it looks like it is not supported. It works fine with Monix backend.

AsyncHttpClientMonixBackend().map(backend => PrometheusBackend(backend)) // OK

AsyncHttpClientCatsBackend[cats.effect.IO]().map(backend => PrometheusBackend(backend)) 

       error: type mismatch;
        found   : sttp.client.SttpBackend[cats.effect.IO,Nothing,sttp.client.asynchttpclient.WebSocketHandler]
        required: sttp.client.SttpBackend[[+A]cats.effect.IO[A],S,[WS_RESULT]sttp.client.asynchttpclient.WebSocketHandler[WS_RESULT]]
       Error occurred in an application involving default arguments.
sttp.client.SttpBackend[cats.effect.IO,Nothing,sttp.client.asynchttpclient.WebSocketHandler] <: sttp.client.SttpBackend[[+A]cats.effect.IO[A],S,[WS_RESULT]sttp.client.asynchttpclient.WebSocketHandler[WS_RESULT]]?
false

Am I missing something?

ybasket
@ybasket
Looks fine. Try to specify the type explicitly, so PrometheusBackend[IO, Nothing, sttp.client.asynchttpclient.WebSocketHandler]
Bruno Campos
@brucampos88_twitter
:thumbsup:
barthorre
@barthorre
Hi, are there some code examples for sttp 3 available apart from the ones https://github.com/softwaremill/sttp/blob/master/examples/src/main/scala/sttp/client3/examples/ that might demonstrate on how to connect 2 zio streams to a websocket? 1 being the request send to the websocket server and 1 reading the responses that come back?
4 replies
barthorre
@barthorre
Hi
Does anyone know how to put the subprotocols for a websocket connections using HttpClientBackend?
private def apply( client: HttpClient, closeClient: Boolean, customizeRequest: HttpRequest => HttpRequest, customEncodingHandler: ZioEncodingHandler ): SttpBackend[Task, ZioStreams with WebSockets] =
in akka there seems to be an other function you can pass
private def make( actorSystem: ActorSystem, ec: ExecutionContext, terminateActorSystemOnClose: Boolean, options: SttpBackendOptions, customConnectionPoolSettings: Option[ConnectionPoolSettings], http: AkkaHttpClient, customizeRequest: HttpRequest => HttpRequest, customizeWebsocketRequest: WebSocketRequest => WebSocketRequest = identity, customEncodingHandler: EncodingHandler = PartialFunction.empty
allowing to set the subprotocol
for http client this seem to be missing
also setting the header Sec-WebSocket-Protocol results in an Illegal Header exception
Adam Warski
@adamw
I can't recall having any tests or supporting ws subprotocols, so it's possible the support is simply not there
you'd have to check if HttpClient supports this at all and then we can try to fix this in sttp
barthorre
@barthorre
  val wsBuilder = client.newWebSocketBuilder()
          client.connectTimeout().map[java.net.http.WebSocket.Builder](wsBuilder.connectTimeout(_))
          request.headers.foreach(h => wsBuilder.header(h.name, h.value))
          val cf = wsBuilder
            .buildAsync(request.uri.toJavaUri, listener)
            .thenApply[Unit](_ => ())
            .exceptionally(t => cb(Left(t)))
          Canceler(() => cf.cancel(true))
        })
19 replies
here you could do wsBuilder.subprotocols afaik
catostrophe
@catostrophe
@adamw hi. do you have any concrete plans regarding the 3.0.0 stable release date? days/weeks/months?
3 replies
Zsolt Szilagyi
@esgott
Hi all
I'm looking at the new v3 API, and there is one thing that caught my eye. In SttpBackend trait, the documentation for send states Type parameters: R – The capabilities required by the request. This must be a subset of the the capabilities supported by the backend (which always includes Effect[F])., which makes sense. However when I'm looking at AkkaHttpBackend, the type returned is SttpBackend[Future, AkkaStreams with WebSockets], so Effect[Future] is not included. Shouldn't that be there?
3 replies
Adam Warski
@adamw

Thank you for being part of the sttp community - Merry Christmas & a more regular 2021 ;)

sttp 3.0 is coming up beginning next year, along with Scala 3!

Rohan Sircar
@rohan-sircar
Merry Christmas Adam! Eager to see the release of Scala 3 and sttp 3. Also, I understand quicklens and macwire will take time since they need to be rewritten in scala3 macros, but I hope they do get ported to scala 3 in future.
2 replies
Adam Warski
@adamw
sttp client 3.0.0 got released, enjoy :) thanks for all the contributions & testing!
Philipp Dörfler
@phdoerfler
congrats! :)
Philipp Dörfler
@phdoerfler

I'm currently idiot-testing 3.0.0's akka websockets, so I created a minimal build.sbt and copy pasted this example:
https://sttp.softwaremill.com/en/latest/examples.html#open-a-websocket-using-akka

It doesn't compile! It complains:

Symbol 'type akka.event.LoggingAdapter' is missing from the classpath.
This symbol is required by 'value sttp.client3.akkahttp.AkkaHttpBackend.customLog'.
Make sure that type LoggingAdapter is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.

The akka documentation says for logging you need: "com.typesafe.akka" %% "akka-actor" % "2.6.10"
However, I saw that sttp3's akka-http-backend has this listed as provided so I went with that instead: "com.typesafe.akka" %% "akka-stream" % "2.6.10"

It compiles, but I get 0 output when I run the example. No error, no nothing.

build.sbt:

name := "meep"
scalaVersion := "2.13.4"

libraryDependencies ++= Seq(
  "com.softwaremill.sttp.client3" %% "core" % "3.0.0",
  "com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.0.0",
  "com.typesafe.akka" %% "akka-stream" % "2.6.10"
)
4 replies
Philipp Dörfler
@phdoerfler

Playing this game with the monix example, I get this SSL exception when running:

runMain sttp.client3.examples.WebSocketMonix
[info] running sttp.client3.examples.WebSocketMonix
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[error] (run-main-4) sttp.client3.SttpClientException$ConnectException: Exception when sending request: GET wss://echo.websocket.org
[error] sttp.client3.SttpClientException$ConnectException: Exception when sending request: GET wss://echo.websocket.org
[error] Caused by: java.net.ConnectException: handshake timed out after 10000ms
[error] Caused by: io.netty.handler.ssl.SslHandshakeTimeoutException: handshake timed out after 10000ms

(I've omitted the stack trace elements in between due to gitter's message limits)

Philipp Dörfler
@phdoerfler
I do have an ancient Java 8 on this machine and I wouldn't be surprised if this is the cause of the SSL exception, let me upgrade it right quick
2 replies
Michal Lacko
@visox
hello, i am getting Defect in zio.Has: Set(SttpBackend[=λ %2:0 → ZIO[-Any,+Throwable,+2:0],+{ZioStreams & package::WebSockets}]) statically known to be contained within the environment are missing with latest async-http-client-backend-zio 3.0.0-RC3 any obvious ideas ?
1 reply
coreteam-co
@coreteam-co

Hi guys, I'm seeing a very strange issue when using sttp as a web socket client:

basicRequest.auth
      .basic(username, password)
      .response(asWebSocketStream(Fs2Streams[F])(webSocketFramePipe(q)))
      .get(uri)
      .send(backend)
      .void

Sometimes I'm seeing this exception when running the above code:

sttp.client3.DeserializationException: exhausted input

I'm suspecting this is an upstream server issue (it gets resolved when they restart it). On the other side using python I can connect without those issues. Anybody has seen something similar or has a hint on how to trace it down?

15 replies
Jakub Kozłowski
@kubukoz
is there an interop layer between sttp2 and 3?
1 reply
I have an sttp2 request and an sttp3 backend :sweat_smile:
Jakub Kozłowski
@kubukoz
for now I guess I'll have two backends
sebver
@sebver
hi! It seems like I'm also running into the Defect in zio.Has: Set(SttpBackend[=λ %2:0 → ZIO[-Any,+Throwable,+2:0],+{ZioStreams & package::WebSockets}]) mentioned above. I'm just not sure why, because I think I'm using the right versions (sttp = 3.0.0, zio = 1.0.3, tapir = 0.17.7). Any ideas?
2 replies
Jonas Adler
@jadlr
Hi all, I have question concerning Uri: Let's say I have a Uri from the value https://example.com/v2/ is there an easy operation to add a path without having to take care of leading and trailing slashes? something line uri.addPath("/users/hello/what")
I tried a couple of things, but I always end up with multiple slashed or the v2 missing.
Jonas Adler
@jadlr
  val uri = Uri.unsafeParse("https://api.example.com/v2/")

  println(uri.path.length) // 2
  println(uri.addPath("users", "123")) // https://api.example.com/v2//users/123
This kind of feels like a bug
1 reply
Philip Moy
@moyphilip
This message was deleted
3 replies
Philip Moy
@moyphilip
Is it possible to set pathEncoding = PathEncoding.None for the uri interpolator?
5 replies
Philip Moy
@moyphilip
Screen Shot 2021-02-01 at 9.52.15 AM.png
Jonas Adler
@jadlr
Hi, i opened an issue concerning Uri.parse here: softwaremill/sttp-model#64
Is that the correct place?
Is there a way to request String urls until this is fixed?