Build failures with hoauth2-1.14.0?
Closed this issue · 6 comments
I am encountering a confusing issue building this library, apparently caused by a change in the hoauth2 API at some point since 1.8.3 (EDIT: changed in 1.9.0), where authGetBS
used to return an IO (Either (OAuth2Error Value) ByteString)
and now returns IO (Either ByteString ByteString)
. This breakage seems somewhat surprising given the message for 0036d5f along with the latest changelog.
To reproduce: add this to the stack.yaml
extra-deps:
- hoauth2-1.14.0
Failing:
[nix-shell:~/dev/yesod-auth-oauth2]$ stack ghci
Configuring GHCi with the following packages: yesod-auth-oauth2
GHCi, version 8.6.3: http://www.haskell.org/ghc/ :? for help
[1 of 6] Compiling URI.ByteString.Extension ( /home/jade/dev/yesod-auth-oauth2/src/URI/ByteString/Extension.hs, interpreted )
[2 of 6] Compiling Yesod.Auth.OAuth2.ErrorResponse ( /home/jade/dev/yesod-auth-oauth2/src/Yesod/Auth/OAuth2/ErrorResponse.hs, interpreted )
[3 of 6] Compiling Yesod.Auth.OAuth2.Exception ( /home/jade/dev/yesod-auth-oauth2/src/Yesod/Auth/OAuth2/Exception.hs, interpreted )
[4 of 6] Compiling Yesod.Auth.OAuth2.Dispatch ( /home/jade/dev/yesod-auth-oauth2/src/Yesod/Auth/OAuth2/Dispatch.hs, interpreted )
[5 of 6] Compiling Yesod.Auth.OAuth2 ( /home/jade/dev/yesod-auth-oauth2/src/Yesod/Auth/OAuth2.hs, interpreted )
[6 of 6] Compiling Yesod.Auth.OAuth2.Prelude ( /home/jade/dev/yesod-auth-oauth2/src/Yesod/Auth/OAuth2/Prelude.hs, interpreted )
/home/jade/dev/yesod-auth-oauth2/src/Yesod/Auth/OAuth2/Prelude.hs:89:34: error:
• Couldn't match type ‘BL.ByteString’ with ‘OAuth2Error Value’
Expected type: IO (Either (OAuth2Error Value) BL.ByteString)
Actual type: IO (Either BL.ByteString BL.ByteString)
• In the second argument of ‘(=<<)’, namely
‘authGetBS manager (accessToken token) url’
In a stmt of a 'do' block:
resp <- fromAuthGet name
=<< authGetBS manager (accessToken token) url
In the expression:
do resp <- fromAuthGet name
=<< authGetBS manager (accessToken token) url
decoded <- fromAuthJSON name resp
pure (decoded, resp)
|
89 | resp <- fromAuthGet name =<< authGetBS manager (accessToken token) url
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, five modules loaded.
Loaded GHCi configuration from /tmp/jade/haskell-stack-ghci/77338fc5/ghci-script
*Yesod.Auth.OAuth2>
Leaving GHCi.
Working result from running stack repl without changing the hoauth2 version:
[nix-shell:~/dev/yesod-auth-oauth2]$ stack repl src/Yesod/Auth/OAuth2/Prelude.hs
Using configuration for yesod-auth-oauth2:lib to load /home/jade/dev/yesod-auth-oauth2/src/Yesod/Auth/OAuth2/Prelude.hs
Configuring GHCi with the following packages: yesod-auth-oauth2
GHCi, version 8.6.3: http://www.haskell.org/ghc/ :? for help
[1 of 6] Compiling URI.ByteString.Extension ( /home/jade/dev/yesod-auth-oauth2/src/URI/ByteString/Extension.hs, interpreted )
[2 of 6] Compiling Yesod.Auth.OAuth2.ErrorResponse ( /home/jade/dev/yesod-auth-oauth2/src/Yesod/Auth/OAuth2/ErrorResponse.hs, interpreted )
[3 of 6] Compiling Yesod.Auth.OAuth2.Exception ( /home/jade/dev/yesod-auth-oauth2/src/Yesod/Auth/OAuth2/Exception.hs, interpreted )
[4 of 6] Compiling Yesod.Auth.OAuth2.Dispatch ( /home/jade/dev/yesod-auth-oauth2/src/Yesod/Auth/OAuth2/Dispatch.hs, interpreted )
[5 of 6] Compiling Yesod.Auth.OAuth2 ( /home/jade/dev/yesod-auth-oauth2/src/Yesod/Auth/OAuth2.hs, interpreted )
[6 of 6] Compiling Yesod.Auth.OAuth2.Prelude ( /home/jade/dev/yesod-auth-oauth2/src/Yesod/Auth/OAuth2/Prelude.hs, interpreted )
Ok, six modules loaded.
Loaded GHCi configuration from /tmp/jade/haskell-stack-ghci/77338fc5/ghci-script
*Yesod.Auth.OAuth2.Prelude> import Network.OAuth.OAuth2
*Yesod.Auth.OAuth2.Prelude Network.OAuth.OAuth2> :t authGetBS
authGetBS
:: FromJSON err =>
Manager
-> AccessToken -> URI -> IO (OAuth2Result err BL.ByteString)
*Yesod.Auth.OAuth2.Prelude Network.OAuth.OAuth2>
hoauth2 API at some point since 1.8.3 (EDIT: changed in 1.9.0), where
authGetBS
used to return...
I vaguely remember this, and I think it was the exact reason for the <1.9
bound before 0036d5f. I must've missed that the upper bound was also changing in that commit.
So, I think what your saying is that:
- - hoauth2 >=1.3.0 && <1.9
+ - hoauth2 >=1.7.0 && <1.11
Should've been:
- - hoauth2 >=1.3.0 && <1.9
+ - hoauth2 >=1.7.0 && <1.9
I'll tighten that back up now.
It would be nice to have support for a newer hoauth2 as 1.8.0 is fairly old.
Would you mind tightening the bound on hackage as well, either through a metadata revision or a patch release? I just ran into this issue as well.
Awesome, thanks!