portkey 2017-10-01

baptiste-from-paris 2017-10-01T13:48:27.000055Z

@baptiste-from-paris has joined the channel

baptiste-from-paris 2017-10-01T13:48:34.000011Z

hello all 🙂

baptiste-from-paris 2017-10-01T14:03:07.000109Z

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

baptiste-from-paris 2017-10-01T14:03:46.000004Z

Just to be sure, it should return a string right ?

baptiste-from-paris 2017-10-01T14:29:38.000048Z

because I have this error

{
errorMessage: "Error loading class portkey.LambdaStub",
errorType: "java.lang.ExceptionInInitializerError"
}

baptiste-from-paris 2017-10-01T14:30:21.000043Z

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 ?

baptiste-from-paris 2017-10-01T15:13:14.000067Z

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}})

baptiste-from-paris 2017-10-01T15:13:31.000011Z

I just generated a lein new app

looks a bit different to what I ran into, what does the stack trace look like?

baptiste-from-paris 2017-10-01T15:16:31.000003Z

and let me find the stacktrace, 1min

thinking about global leiningen profile in my case now

baptiste-from-paris 2017-10-01T15:18:22.000030Z

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

Where do you get the exception? Locally or in AWS?

baptiste-from-paris 2017-10-01T15:54:02.000031Z

aws

baptiste-from-paris 2017-10-01T15:54:18.000048Z

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.

baptiste-from-paris 2017-10-01T16:30:35.000056Z

ok, will do tonight

apparently I had introduced one breakage at least, which is probably unrelated

should start working on test on the AWS code to run actual deploys in CircleCI

baptiste-from-paris 2017-10-01T17:39:49.000060Z

@viesti I updated portkey and it’s now working... /cc @cgrand

baptiste-from-paris 2017-10-01T17:40:05.000146Z

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

Maybe part of a recent change to Clojure

yes, saw 1.9.0-beta1 as dependency but couldn’t reproduce myself just now, but might still be related

somewhat warm feeling that it works for you though now 🙂

baptiste-from-paris 2017-10-01T17:47:49.000069Z

I’d really love to understand what’s happening in portkey but I am really lost ^^

baptiste-from-paris 2017-10-01T17:49:18.000046Z

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)

this would cover POST support

guess I could close related tickets, and make new one about making this into a macro like pk/mount!

baptiste-from-paris 2017-10-01T18:00:25.000215Z

ok nice, let me try then 🙂

one fix more, mount-ring! might now work again

baptiste-from-paris 2017-10-01T18:13:46.000070Z

yes, was not mounting ^^

worked for me, even tried out now 🙂

yesterday ran into an issue with instaparse, used by compojure, haven’t solved it yet but at least POST requests can be made

baptiste-from-paris 2017-10-01T18:20:41.000028Z

what means /{proxy+} in the path ?

baptiste-from-paris 2017-10-01T18:21:14.000120Z

*in aws api gateway

baptiste-from-paris 2017-10-01T18:24:57.000041Z

ok, thanks

baptiste-from-paris 2017-10-01T18:25:34.000075Z

why is it usefull ?

we grab all requests under that path and proxy them to the lambda

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

baptiste-from-paris 2017-10-01T18:28:05.000030Z

ok

so that api gateway is more like a reverse proxy sitting in front of the lambda

baptiste-from-paris 2017-10-01T18:30:30.000083Z

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

baptiste-from-paris 2017-10-01T18:32:56.000043Z

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 🙂

baptiste-from-paris 2017-10-01T18:35:48.000049Z

that’s amazing what you’ve done !

😊 1

thank you 🙂

baptiste-from-paris 2017-10-01T19:03:23.000058Z

ok, POST working great 🙂 ! trying to add middleware

would be happy to hear how it progresses 🙂

baptiste-from-paris 2017-10-01T20:00:21.000126Z

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))

baptiste-from-paris 2017-10-01T21:08:57.000007Z

nice !

baptiste-from-paris 2017-10-01T21:09:01.000044Z

thx

baptiste-from-paris 2017-10-01T21:19:02.000044Z

@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