Closed gchudnov closed 4 years ago
I've just tested locally and the test worked fine (well I was using scalatest instead of zio-test, could this be a factor)? Maybe you could give more details on the exception, where is it thrown exactly?
hm. got it, thank you for reply. let me check without zio-test...
I'm constantly getting an error inside of zio.Has
here
when setting a breakpoint there I can see there 2 sets, but SttpBackend
is a bit different inside (see below).
and the exception is thrown throw new Error(s"Defect in zio.Has: ${missingServices} statically known to be contained within the environment are missing")
set:
set = {Set$Set2@3055} "Set$Set2" size = 2
0 = {LightTypeTag$$anon$1@3063} "package::SttpClientStubbing::Service"
1 = {LightTypeTag$$anon$1@3064} "SttpBackend[=λ %2:0 → ZIO[-Any,+Throwable,+2:0],+{ZioStreams & package::WebSockets}]"
self.map.keySet:
keySet = {MapOps$ImmutableKeySet@3089} "MapOps$ImmutableKeySet" size = 2
0 = {LightTypeTag$ParsedLightTypeTag@3087} "package::SttpClientStubbing::Service"
1 = {LightTypeTag$ParsedLightTypeTag@3088} "SttpBackend[=λ %1:0 → ZIO[-Any,+Throwable,+1:0],+{package::WebSockets & ZioStreams}]"
@adamw
hm. just run without zio-test, still the same exception.
created a really simple project that reproduces the problem: https://github.com/gchudnov/zio-sttp-test
-- Wondering if your current code for v3 branch significantly diverged from "3.0.0-RC5" and doesn't have this problem anymore (?)
This is really weird. Indeed, when I copy-paste your code into sttp for a quick test, it works. When I run your project, it fails. And the only changes there were are in docs: https://github.com/softwaremill/sttp/compare/v3.0.0-RC5...master
Ah! It works with zio 1.0.1, but breaks with 1.0.3. So maybe that's a regression in their code? I didn't investigate much further.
While not a fix, it's always a work-around (to use the older zio version)
sttp is still on 1.0.1 because of dotty, I need to upgrade that one day :)
I think that's a binary incompatibility between 1.0.1 and 1.0.3. After updating sttp to 1.0.3, it works again. I'll release RC6 soon with update zio.
got it, thank you for the explanation!
guess this issue can be closed.
3.0.0-RC6 is out, please test :)
@adamw
yes, it works! thank you very much!
Hi
I'm trying to write a test for zio "1.0.3" & sttp "3.0.0-RC5" and have an issue with Has[_].
it looks like a problem in ZIO and I raised an issue https://github.com/zio/zio/issues/4340 there
but I noticed there is a comment in sttp regarding Has and wondering if there is a workaround for the problem I bumped into? or if I'm writing this test in a wrong way ?
the minimized code that gives an error looks something like:
An advice is appreciated.
Thank you, Grigorii