# Is it possible to use Sttp on Scala native?

**URL:** <https://softwaremill.community/t/is-it-possible-to-use-sttp-on-scala-native/233>\
**Category:** sttp client\
**Created:** [June 23, 2023, 9:48am UTC](https://softwaremill.community/t/is-it-possible-to-use-sttp-on-scala-native/233 "2023-06-23T09:48:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sergeda](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/sergeda/32/156_2.png) [@sergeda](https://softwaremill.community/u/sergeda)\
**Post date:** [June 23, 2023, 9:48am UTC](https://softwaremill.community/t/is-it-possible-to-use-sttp-on-scala-native/233/1 "2023-06-23T09:48:36Z")

</div>

I’m trying to use Sttp 3 client in Scala native project.  
I’ve added these dependencies:

```auto
      "com.softwaremill.sttp.client3" %% "async-http-client-backend-cats" % "3.8.15",
      "com.softwaremill.sttp.client3" % "cats_native0.4_3" % "3.8.15"

```

And in my code I’m trying to get backend using:

```auto
    HttpClientCatsBackend.resource[IO]().use(backend =>
      IO.println("test").map(_ => ExitCode.Success)
    )

```

But I’m getting these errors:

```auto
[error] Not found Top(sttp.client3.httpclient.cats.HttpClientCatsBackend$)
[error] Not found Member(Top(sttp.client3.httpclient.cats.HttpClientCatsBackend$),D18resource$default$1L31sttp.client3.SttpBackendOptionsEO)
[error] Not found Member(Top(sttp.client3.httpclient.cats.HttpClientCatsBackend$),D18resource$default$2L15scala.Function1EO)
[error] Not found Member(Top(sttp.client3.httpclient.cats.HttpClientCatsBackend$),D18resource$default$3L21scala.PartialFunctionEO)
[error] Not found Member(Top(sttp.client3.httpclient.cats.HttpClientCatsBackend$),D8resourceL31sttp.client3.SttpBackendOptionsL15scala.Function1L21scala.PartialFunctionL24cats.effect.kernel.AsyncL27cats.effect.kernel.ResourceEO)

```

Is it possible to use client on Scala native? If so, are there any example repos or documentation?

---

<div class="post-metadata">

**Author:** ![kciesielski](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/kciesielski/32/133_2.png) [@kciesielski](https://softwaremill.community/u/kciesielski)\
**Post date:** [June 23, 2023, 1:14pm UTC](https://softwaremill.community/t/is-it-possible-to-use-sttp-on-scala-native/233/2 "2023-06-23T13:14:23Z")

</div>

@sergeda The `async-http-client-backend-*` backend family is not built for scala native. If I read the project correctly, the only supported native backend right now is `fs2`, could you try it?

---

<div class="post-metadata">

**Author:** ![sergeda](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/sergeda/32/156_2.png) [@sergeda](https://softwaremill.community/u/sergeda)\
**Post date:** [June 23, 2023, 3:02pm UTC](https://softwaremill.community/t/is-it-possible-to-use-sttp-on-scala-native/233/3 "2023-06-23T15:02:37Z")

</div>

Thank you @kciesielski  
I updated my imports with

```auto
      "com.softwaremill.sttp.client3" %% "async-http-client-backend-fs2" % "3.8.15",
      "com.softwaremill.sttp.client3" % "fs2_native0.4_3" % "3.8.15"

```

but got similar errors:

```auto
[error] Not found Top(sttp.client3.httpclient.fs2.HttpClientFs2Backend$)
Member(Top(sttp.client3.httpclient.fs2.HttpClientFs2Backend$),D18resource$default$1L31sttp.client3.SttpBackendOptionsEO)
Member(Top(sttp.client3.httpclient.fs2.HttpClientFs2Backend$),D18resource$default$2L15scala.Function1EO)
Member(Top(sttp.client3.httpclient.fs2.HttpClientFs2Backend$),D18resource$default$3L21scala.PartialFunctionEO)
Member(Top(sttp.client3.httpclient.fs2.HttpClientFs2Backend$),D8resourceL31sttp.client3.SttpBackendOptionsL15scala.Function1L21scala.PartialFunctionL24cats.effect.kernel.AsyncL27cats.effect.kernel.ResourceEO)

```

Maybe I’m doing something wrong because I saw mentions about usages of sttp client in Scala Native. Just can’t find any working example.

---

<div class="post-metadata">

**Author:** ![kciesielski](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/kciesielski/32/133_2.png) [@kciesielski](https://softwaremill.community/u/kciesielski)\
**Post date:** [June 23, 2023, 3:09pm UTC](https://softwaremill.community/t/is-it-possible-to-use-sttp-on-scala-native/233/4 "2023-06-23T15:09:55Z")

</div>

Sorry for misleading, the `cats` backend you used in your previous question also supports native platform, just like `fs2`. It’s just the first dependency - `async-http-client-backend-*` which is unneeded, but let me confirm the exact setup.

---

<div class="post-metadata">

**Author:** ![sergeda](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/sergeda/32/156_2.png) [@sergeda](https://softwaremill.community/u/sergeda)\
**Post date:** [June 27, 2023, 5:27am UTC](https://softwaremill.community/t/is-it-possible-to-use-sttp-on-scala-native/233/5 "2023-06-27T05:27:26Z")

</div>

I’m getting this error when I’m removing “async-http-client-backend-\*” dependency:

```auto
[error] 9 |import sttp.client3.httpclient.fs2.HttpClientFs2Backend
[error] | ^^^^^^^^^^^^^^^^^^^^^^^
[error] | value httpclient is not a member of sttp.client3
[error] one error found
[error] (Compile / compileIncremental) Compilation failed

```

So, not sure where to get the required backend import

---

<div class="post-metadata">

**Author:** ![kciesielski](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/kciesielski/32/133_2.png) [@kciesielski](https://softwaremill.community/u/kciesielski)\
**Post date:** [June 27, 2023, 1:49pm UTC](https://softwaremill.community/t/is-it-possible-to-use-sttp-on-scala-native/233/6 "2023-06-27T13:49:19Z")

</div>

@sergeda It turns out mentioned modules are available for native, but they don’t offer full backends. The only backend supported currently on Native is CurlBackend [Curl backend — sttp 3 documentation](https://sttp.softwaremill.com/en/stable/backends/native/curl.html)

---

<div class="post-metadata">

**Author:** ![sergeda](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/sergeda/32/156_2.png) [@sergeda](https://softwaremill.community/u/sergeda)\
**Post date:** [June 27, 2023, 6:49pm UTC](https://softwaremill.community/t/is-it-possible-to-use-sttp-on-scala-native/233/7 "2023-06-27T18:49:57Z")

</div>

@kciesielski Thank you. Will try this
