haskell-servant / haskell-servant/servant

servant with servant-auth and jwts disallows a route with '[WithStatus 302 Redirect]

Open
#1,631 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
2k
Forks
427
Avg merge
2d 23h
Merged PRs (30d)
5

Description

it looks like, because of how named-routes must be implemented, we get an overlapping instance warning if we have a custom route that _also_ does a 302 redirect:

the error is:

```
• Overlapping instances for Servant.Server.Internal.HasServer
(Servant.Auth.Server.Internal.AddSetCookie.AddSetCookieApi
(Servant.Auth.Server.Internal.AddSetCookie.AddSetCookieApi
(UVerb 'GET '[HTML] '[WithStatus 302 Redirect])))
'[Servant.Auth.Server.Internal.ConfigTypes.CookieSettings,
Servant.Auth.Server.Internal.ConfigTypes.JWTSettings]
arising from a use of ‘genericServeTWithContext’
```

my own code had a custom route like:

```
data PrivateRoutes mode = PrivateRoutes
{ thing :: mode :- "thing" :> UVerb 'GET '[HTML] '[WithStatus 302 Redirect] }
```

a hacky "fix" is just to remove this route; then it compiles

can prepare a full working repro a bit later, if it's useful

my `app` looks something like:

```
app :: Application
app = genericServeTWithContext id server ctx
where
key = ...
jwtConfig = defaultJWTSettings key
ctx = defaultCookieSettings :. jwtConfig :. EmptyContext
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.