This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-01
Channels
- # beginners (15)
- # boot (3)
- # cider (10)
- # clara (2)
- # cljs-dev (19)
- # clojure (31)
- # clojure-uk (9)
- # clojurescript (60)
- # core-async (1)
- # datomic (10)
- # docs (4)
- # fulcro (5)
- # hoplon (33)
- # juxt (1)
- # luminus (1)
- # off-topic (3)
- # om (20)
- # parinfer (2)
- # portkey (61)
- # re-frame (6)
- # reagent (39)
- # shadow-cljs (18)
- # spacemacs (4)
- # specter (8)
hello all š
I am trying to make portkey
work with the example from the README
. Once I depoly/mount the flatten function and I try to call it with query-params, I have a blank page as a respone
Just to be sure, it should return a string right ?
because I have this error
{
errorMessage: "Error loading class portkey.LambdaStub",
errorType: "java.lang.ExceptionInInitializerError"
}
with this code
(defn welcome [] "Hello world !")
(pk/mount! welcome "/welcome")
@baptiste-from-paris @viesti ran into a similar issue yesterday, I havenāt had to dig in yet. Are you using it with lein? In which profile did you put portkey ?
lein => yes lein install
then
(defproject port "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url ""
:license {:name "Eclipse Public License"
:url ""}
:dependencies [[org.clojure/clojure "1.9.0-beta1"]
[portkey "0.1.0-SNAPSHOT"]]
:main ^:skip-aot port.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
I just generated a lein new app
ok, so thatās the route => https://pywts6bswb.execute-api.eu-west-1.amazonaws.com/repl/woo
and let me find the stacktrace, 1min
Error loading class portkey.LambdaStub: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
Caused by: java.lang.Exception: Nothing specified to load, compiling:(NO_SOURCE_PATH:0:0)
at clojure.core$throw_if.invokeStatic(core.clj:5808)
at clojure.core$throw_if.doInvoke(core.clj:5795)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.core$load_libs.invokeStatic(core.clj:5924)
at clojure.core$load_libs.doInvoke(core.clj:5910)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:659)
at clojure.core$require.invokeStatic(core.clj:5948)
at clojure.core$require.doInvoke(core.clj:5948)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invokeStatic(core.clj:657)
at clojure.core$apply.invoke(core.clj:652)
at portkey.core$bootstrap$fn__17842.invoke(core.clj:187)
at portkey.LambdaStub.<clinit>(LambdaStub.java:23)
... 2 more
Caused by: java.lang.Exception: Nothing specified to load
... 15 more
no exceptions/errors locally
Oh I see an interesting line: require complaining to be called with no args. Would you mind opening an issue? Merci
spotted that too but couldnāt explain, wild shot but what Leiningen version are you running on? Could could you try without a ~/.lein/profile.clj
, if one is present, for a clean Leiningen repl.
ok, will do tonight
@viesti I updated portkey and itās now working... /cc @cgrand
thankās for your time and help
interesting, meanwhile, the exception was caused by an empty list of requires: https://github.com/portkey-cloud/portkey/blob/master/src/main/clojure/portkey/core.clj#L187
donāt yet know how that happened, a guard for that case could prevent it but a cause for that would be neat to know
yes, saw 1.9.0-beta1 as dependency but couldnāt reproduce myself just now, but might still be related
Iād really love to understand whatās happening in portkey but I am really lost ^^
by the way, Iāve seen that you plan to add POST support, any idea what are the challenges with the addition ?
yesterday landed first version of mounting a ring handler into master with pk/mount-ring!
, it takes a var for now, so you have to call (pk/mount-ring! #āmy-handler)
guess I could close related tickets, and make new one about making this into a macro like pk/mount!
ok nice, let me try then š
yes, was not mounting ^^
yesterday ran into an issue with instaparse, used by compojure, havenāt solved it yet but at least POST requests can be made
what means /{proxy+}
in the path ?
*in aws api gateway
itās a swagger path template (https://swagger.io/specification/#pathTemplating), with a greedy variable (http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html#api-gateway-set-up-lambda-proxy-integration-on-proxy-resource), meaning that matches everything after /
and binds the match to variable named proxy
ok, thanks
why is it usefull ?
api gateway can have also more specific routes, like the ones created with mount!, the proxy resource allows us to get a more ārawā request into the lambda
ok thanks, so other routes created with mount!
should be bypassed right ?
api gateway matches to the most specific route, so one could have say /{proxy+} with ANY method and a /hello with GET method and /hello would match for a GET request but a POST to /hello would go to the proxy route
ok thanks !
not yet sure if portkey should make some decision regarding this, but right now on the path to just deploying and exposing functions š
thatās amazing what youāve done !
ok, POST working great š ! trying to add middleware
by the way, do you know if itās possible to package a conf file ?
@baptiste-from-paris use the :keeps
option (takes a list of classes or resources (as strings))
@cgrand itās only vars & classes that can be kepts right ? not random file from a resources folder for example
@baptiste-from-paris classes and resources; vars I donāt remember having to