Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 23 18:15

    mergify[bot] on master

    Update scribe to 3.8.3 Merge pull request #1445 from s… (compare)

  • May 23 18:15
    mergify[bot] closed #1445
  • May 22 07:40
    mergify[bot] labeled #1445
  • May 22 07:38
    scala-steward opened #1445
  • May 21 05:47

    mergify[bot] on master

    Update cats-effect, cats-effect… Merge pull request #1444 from s… (compare)

  • May 21 05:47
    mergify[bot] closed #1444
  • May 21 05:15
    mergify[bot] labeled #1444
  • May 21 05:14
    scala-steward opened #1444
  • May 20 17:33

    mergify[bot] on master

    Update http4s-blaze-client, htt… Merge pull request #1443 from s… (compare)

  • May 20 17:33
    mergify[bot] closed #1443
  • May 20 17:00
    mergify[bot] labeled #1443
  • May 20 17:00
    scala-steward opened #1443
  • May 20 10:46
    adamw opened #1442
  • May 20 07:12

    adamw on v3.6.2

    (compare)

  • May 20 07:12

    adamw on master

    Release 3.6.2 (compare)

  • May 20 06:38

    mergify[bot] on otel

    (compare)

  • May 20 06:37

    adamw on master

    Fix naming of OpenTelemetry bac… Fix naming of metrics & instrum… Fix naming of instrumentation s… and 8 more (compare)

  • May 20 06:37
    adamw closed #1441
  • May 20 05:55

    adamw on master

    Docs (compare)

  • May 20 05:54
    adamw synchronize #1441
Kopaniev Vladyslav
@VladKopanev

Hey team, sttp 3.3.15 introduced a binary incompatibility with 3.3.14, is that a known issue? Particularly it was this change:
https://github.com/softwaremill/sttp/pull/1119/files#diff-328a76b199b03a413e3a607009ce6d0ee31047193247381451e5b1362c1c96eeR15

I spotted this because my application gave me a "Exception in thread "main" java.lang.NoSuchMethodError: sttp.client3.FollowRedirectsBackend.<init>(Lsttp/client3/SttpBackend;Lscala/collection/immutable/Set;Lscala/collection/immutable/Set;)V"

(That happened after I updated one of my dependencies which transitively pulled 3.3.16 and my current version of sttp which was 3.3.14 was evicted)

1 reply
Kopaniev Vladyslav
@VladKopanev
^^ it's strange that it happened because mima plugin was enabled after 3.3.14, and if you checkout tag 3.3.15 and try to run "mimaReportBinaryIssues" it will error
Found possible hint:
https://github.com/softwaremill/sttp/runs/3776276618?check_suite_focus=true#step:8:1221
The corresponding CI build was not checking bincompat because "mimaPreviousArtifacts" was empty for some reason
Kopaniev Vladyslav
@VladKopanev
It looks like even for releases mima won't check "core" module bincompat issues:
https://github.com/softwaremill/sttp/runs/4272599204?check_suite_focus=true#step:8:1252
9 replies
Eric Meisel
@etspaceman

Hi there. I'm having a hard time upgrading from v2 to v3 due to the requirement of send to tie R to an Effect[F]

I had a class with the following definition:

class TracedLoggingSttpBackend[F[_], G[_]: Sync: Trace, +P](
    val delegate: SttpBackend[F, P],
    liftK: F ~> G
  ) extends SttpBackend[G, P]

And I was able to pass the Request from the backend to its delegate and simply run liftK on the result of it.

Now, because Request is tied to the SttpBackend's first type param (F or G), the requests become incompatible.

This was the setup we were using to tie in Natchez's kleisli usage through Sttp's backends.

4 replies

From what I can see, I need to be able to convert between the two, like so:

def convertRequest[T, RF >: P with Effect[F], RG >: P with Effect[G]](
      request: Request[T, RG]
    ): Request[T, RF]

But I have no idea how I could accomplish that

Frej Soya
@frejsoya
Simple problem here. Adding
libraryDependencies += "com.softwaremill.sttp.client3" %% "core" % "3.3.18" does not seem to update dependencies/add sttp to the classpath. Likely simple problem of me not having used scala in 5+ years :)
1 reply
Batiste Dekimpe
@batiste-dek_gitlab

Hi there, I'm running into issues using AsyncHttpClientZioBackend. I'm initiating it like that:

lazy val httpClientLayer: ULayer[Has[SttpBackend[Task, ZioStreams with capabilities.WebSockets]]] = {
    ZLayer.fromAcquireRelease(AsyncHttpClientZioBackend())(_.close().ignore).orDie
  }

and giving it to my class using Zlayer. Unfortunately, I have requests that send me the error: IllegalStateException: Closed. I'm wondering if anyone had issues with this before. Thanks a lot in advance

1 reply
Piotr Buszka
@pbuszka

I have a strange low level exception ('IndexOutOfBoundsException') in 'backend.send(req)' which appears only on 1 out of ~100 endpoints . I'm clutching at straws with this bug and the my hipotesis is that moving from sttp 3.3.4 to 3.3.18 and upgrade of scalajs-dom to 2.0.0 is the differential "cause".

  • sttp 3.3.4 compiled and linked with scalajs-dom 1.2 and there was no error.
  • sttp 3.3.4 and scalajs-dom 2.0.0 it compiles but fails on linking. 3.3.18 and 2.0.0. it compiles and linkes but systematically fails in execution on 1 particular endpoint.

I'm using FetchMonixBackend and I see in the source code that it still uses 'import org.scalajs.dom.experimental...' which is no longer available in scalajs-dom 2.0.0

Is sttp compatible with scalajs-dom 2.0.0 ?
Any clues what can I check more ?

2 replies
Andrius Bentkus
@txdv
Hi guys, how do I force sttp Uri to encode the query fragment with %?
1 reply
Tim Pigden
@TimPigden
Hi, I'm using sttp3 from zio. I'm trying to track down a bug (in my code) whereby the client thinks it's' sending a post but nothing is happening as far as the gateway logs are concerned. One of things I've realised is that 2 different areas of the code are using their own instances of AsyncHttpClientZioBackend.layer(), in one case and AsyncHttpClientZioBackend.usingConfig(config)
in another. Is this likely to cause a problem?
4 replies
Alex Myodov
@amyodov
Hello. Using sttp.client3 with AkkaHttpBackend. I see that internally, AkkaHttpBackend uses “classic” Akka model (ActorSystem, etc). So when doing AkkaHttpBackend.usingActorSystem(actorSystem), actorSystem must be a classic actor system, not a typed one. Any hints how I can take my existing typed actor system and use it in AkkaHttpBackend.usingActorSystem?
2 replies
Andrius Bentkus
@txdv
Is it possible to leave the encoding as is with sttp.url for allowed chars? for exmaple if I have https://www.test.com/A%27B, it will convert it to https://www.test.com/A'B, but I want to preserve the %27
4 replies
Stan Sobolev
@Jacke
Hi guys. Is it possible to convert sttp.monad.MonadError[sttp.client3.Identity] to cats.MonadError[sttp.client3.Identity, Throwable] w/o using effect.IO?
7 replies
Roman Makurin
@Ravenow
hi guys, is there any sport of aws signing in sttp or a way how to do it by yourself?
Igor Tovstopyat-Nelip
@igortn
Is Java 8 the strict requirement for the latest stable? Is Java 11 possible by any chance?
2 replies
For the cats-effect backend. ^
Mikhail Kobenko
@Kobenko
is there a way to disable logging of request and response body on a specific http request in Slf4jLoggingBackend?
6 replies
ex0ns
@ex0ns

I think there is an issue with release 3.4.1 of sttp for zio1.
https://github.com/softwaremill/sttp/blob/v3.4.1/build.sbt#L845 is using zio-json 0.3 which is targeting ZIO2

It should have been 0.2.0-M3 which is the latest release of zio-json for zio 1.
I've opened a PR https://github.com/softwaremill/sttp/pull/1318/files if anyone can have a looks that would be great. Thanks

1 reply
inv
@inv:envs.net
[m]
Hi! Is there something fundamental about why sttp serializes request body eagerly when constructing request instead of when sending it via backend? In my project we implemented wrapper backend which does metrics and logging besides passing request to delegate. We want to log request body, but it often contains sensitive information. Ideally, we want to implement some typeclass, say MaskedBodySerializer and use it in our wrapper backend. But when request reaches backend, its body already serialized to String. One way I see is to use tag for passing masked serialized body. Is there better approach?
2 replies
Andrii Ilin
@ilinandrii
This message was deleted
Andrii Ilin
@ilinandrii
Hi, everyone. So I've got a very strange issue with Java 11 HttpClient.
I'm using sttp client 3 with HttpClientZioBackend and calling vk.com API.
API methods have a . in the name, for example https://api.vk.com/method/photos.getAll (query params omitted)
When I call such a URI I get an error from the API which indicates that i have a problem with an API method.
However if I print url with .show and open it in browser or print curl with .toCurl and run it in console or use synchronous HttpURLConnectionBackend or AsyncHttpClientZioBackend I get a successful response.
I've also used HttpClient directly and reproduced the same problem.
Sure I've got AsyncHttpClientZioBackend as a workaround, but wanted to use client with no extra dependencies, maybe someone knows how to overcome this problem.
1 reply
Vasyl Zhurba
@vasyl-zhurba
Hi, is possible to expose Kafka events documentation via AsyncApi+Tapir (without server logic connected)? Is there an example I could take a look at? I saw websocket examples, but I couldn't adapt it to kafka events documentation
1 reply
Ori Hirshfeld
@ori888_twitter
Hi Everyone,
I'm struggling sending a request with SSL context using HttpClientZioBackend, can someone post a sample code of how it should be done?
Documentation is missing that part.
Thank you
3 replies
Christian Bartolo Burlò
@chrisbartoloburlo

Hello, I am attempting to send requests via sttp3, however I am getting the following error: Cannot prove that Any with sttp.capabilities.Effect[[X]sttp.client3.Identity[X]] <:< Nothing.

I am sending the request as follows:

val api = DefaultApi.apply()
val backend = HttpURLConnectionBackend()
println(api.addProduct("Calculator").send(backend))

where:

def addProduct(productName: String
): Request[Either[ResponseException[String, Exception], String], Nothing] =
    basicRequest
      .method(Method.POST, uri"$baseUrl/products/${productName}")
      .contentType("application/json")
.response(asJson[String])

Am I doing something wrong? Thanks!

6 replies
ex0ns
@ex0ns
The last parameters of the request is the support for capabilities (i.e streaming), if you don't support it you should pass Any and not Nothing, otherwise the compiler will not be able to derive the correct effect (as Nothing is the bottom type)
https://sourcegraph.com/github.com/softwaremill/sttp@177bb70974fbb2bb01aaeae592416743f63cba30/-/blob/core/src/main/scala/sttp/client3/RequestT.scala?L33
  * @tparam R
  *   The backend capabilities required by the request or response description. This might be `Any` (no requirements),
  *   [[Effect]] (the backend must support the given effect type), [[Streams]] (the ability to send and receive
  *   streaming bodies) or [[sttp.capabilities.WebSockets]] (the ability to handle websocket requests).
1 reply
Christian Bartolo Burlò
@chrisbartoloburlo

Hello everyone. The following code is generated using the openapi-generator:

def addRequiresConstraintToProduct(productName: String, sourceFeature: String, requiredFeature: String
): Request[Either[Either[String, String], Unit], Any] =
    basicRequest
      .method(Method.POST, uri"$baseUrl/products/${productName}/constraints/requires")
      .contentType("multipart/form-data")
      .multipartBody(Seq(
                multipart("sourceFeature", sourceFeature)
, 
                multipart("requiredFeature", requiredFeature)

      ).flatten)
.response(asEither(asString, ignore))

And it is giving the following error:

No implicit view available from sttp.model.Part[sttp.client3.BasicRequestBody] => scala.collection.IterableOnce[B]
).flatten)
  ^

Any help would be greatly appreciated. Thanks!

8 replies
Fabrice Sznajderman
@Fabszn
Hi all
I implementing a httpclient to query an API under OAuth2
I using AccessTokenProvider to request the accessToken before to make my business request
When I ran the accessToken request.. I get the following error :
com.ocadotechnology.sttp.oauth2.common$OAuth2Exception: Client call resulted in error (200): expected json value got 'grant_...
I understand than accessProvider requiring the grant_type.. But I don't know how to provide it ... :-/
Fabrice Sznajderman
@Fabszn
Code looks like that :
val accessTokenProvider: AccessTokenProvider[Task] =
          AccessTokenProvider[Task](uri"${tokenUrl}", NonEmptyString.unsafeFrom(clientId), Secret(secret))(sttpBackend)

        (for {
          token: ClientCredentialsToken.AccessTokenResponse <- accessTokenProvider.requestToken(scope)

        } yield token.accessToken.value)
Someone has an idea ?
Many thanks for your help
Fabrice Sznajderman
@Fabszn
As i understand .. The grant_type parameter isn't add to the resquest body ..
Fabrice Sznajderman
@Fabszn
After dive in library that I using.. the problem come from the way of the third-party library build the payload of the query
onsoup42
@onsoup42
Hello! Can we kick off the check on softwaremill/sttp#1407 and/or softwaremill/sttp#1408
9 replies
David Pennell
@dpennell
I'm trying to use the logging backend wrapper as documented. DefaultLog decides whether or not to log by looking at setting derived from a request tag. I see RequestT#logSettings that adds the tag. I expected that the logging backend wrapper would set this tag on every send, but I see no callers of this. What am I missing?
2 replies
Andrii Butko
@andreybutko
Hi
I see you have a lot of cool backends, but the examples are specified for the certain backends, eg: Loggin only with Logging backend and Retry only with ZIO
But can I easily setup logging and retries, but without ZIO?
2 replies
Ghost
@ghost~62703bfc6da037398495c812

Hello! I'm trying to upgrade some code from com.softwaremill.sttp. to sttp.client3., and looking for a way to deal with unsafeBody alternative.

for example,
url = "bad url" token = "bad token"

in softwaremill I did this:
response = Try(sttp.auth.bearer(token).get(uri"$urlStr").send.unsafeBody)
In this case response.isFailure = true

but sttp.client3 doesn't have this method:
response = basicRequest.auth.bearer(token).get(uri"$urlStr").send(backend).body
response match {
case Right(resp) => Try(resp)
case Left(error) =>
logger.error(s"API call failed: $error")
Try(error)
}
But in this case response would give an exception, which I don't need.

Does anyone have some thoughts to do this?

6 replies
Mark de Jong
@Fristi

Are there metrics in sttp which tell you in which stage a request to response is holding up?

  • Obtaining connection from pool
  • Setting up connection to the server
  • Encoding request body
  • Streaming to server
  • Waiting server to reply
  • Decoding response body
  • Streamin from server

Are stages in which a request/response can be ?

I'm using ZIO with AHC
Mark de Jong
@Fristi
Tracing or logging would be nice in this case, opt to choose which mechanism you use for debugging an issue
4 replies
Stephen Marsh
@stephendavidmarsh
I'm building some custom backends with ZIO and am uncertain about what qualifies as a failure or error. If the user of a backend builds requests with .getRight, e.g. .response(asJson[...].getRight), will that convert all errors into failures? Does that mean that the PrometheusBackend won't see any errors if the user does that?
12 replies
Dragos Manolescu
@polymorphic

Hey there, I’m using sttp3 (version 3.5.2) with the akka-http backend. Every now and then I see log messages like the following:

Response entity was not subscribed after 1 second. Make sure to read the response `entity` body or call `entity.discardBytes()` on it -- in case you deal with `HttpResponse`, use the shortcut `response.discardEntityBytes()`

I understand that these log message are emitted by akka-http but I can’t find a way to discard the entity from sttp's error path where I don’t have access to the response. How have you resolved this?

3 replies
Swoorup Joshi
@Swoorup
any thoughts on moving to chat to discord, since there are few other scala communities there, would make it easier :P ?
7 replies
Swoorup Joshi
@Swoorup
I am having an issue where using AsyncHttpClientFs2Backend I am doing requests in a continuous loop, but after network disconnection, it is no longer able to resume the connection and further requests appear to be blocked/hanged. Any ideas?
1 reply