JS code generation fails when Api contains BasicAuth #672

kseo opened this Issue Jan 17, 2017 · 6 comments


None yet

4 participants

kseo commented Jan 17, 2017

writeJSForAPI fails to type check after I add BasicAuth to my api.

/Users/kseo/KodeBoxProjects/kodebox-server/jsgen/Main.hs: 21, 15
• No instance for (servant-foreign-0.8.1:Servant.Foreign.Internal.HasForeign
                        "kodebox-realm" Kodebox.Server.Types.Session
                      Servant.API.Sub.:> Kodebox.Server.Api.PrivateApi))
    arising from a use of ‘writeJSForAPI’
• In the expression:
      restApi vanillaJS (joinPath [outputDir, "Kodebox.js"])
  In an equation for ‘writeJSCode’:
        = writeJSForAPI
            restApi vanillaJS (joinPath [outputDir, "Kodebox.js"])
arianvp commented Jan 17, 2017

Hmm I remember I implemented this at some point, but perhaps it never ended up in master.

@arianvp arianvp self-assigned this Jan 17, 2017
@arianvp arianvp added this to the 0.10 milestone Jan 17, 2017
phadej commented Jan 19, 2017 edited

Related/Duplicates: #463 #672 #465

@arianvp you have an opportunity to close 3 issues with one PR! See also #682

arianvp commented Jan 31, 2017

@phadej Due to exams wasn't able to finish this week. however I don't think this should block the 0.10 release. We can do a 0.10.1 release as the changes are non-breaking

@arianvp arianvp removed this from the 0.10 milestone Jan 31, 2017
phadej commented Jan 31, 2017

@arianvp ack.


Just had the same issue. How can I help?

arianvp commented Feb 9, 2017

A HasForeign instance has to be written for the BasicAuth stuff. Which generates enough information such that servant-js can write auth client code.

Which should be the trivial part: https://stackoverflow.com/questions/5507234/how-to-use-basic-auth-with-jquery-and-ajax

I am a bit busy, so I haven't gotten around doing it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment