portkey 2017-09-04

thinks @tatut has seen first portkeyed lambda success

Error loading class portkey.LambdaStub: class java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
Caused by: com.esotericsoftware.kryo.KryoException: Unable to find class: clojure.core.specs.alpha$fn__24
Serialization trace:
pred (clojure.spec.alpha$spec_impl$reify__751)
val (clojure.lang.Delay)
specs (clojure.spec.alpha$and_spec_impl$fn__869)
cform (clojure.spec.alpha$and_spec_impl$reify__875)
value (java.util.concurrent.atomic.AtomicReference)
state (clojure.lang.Atom)
at com.esotericsoftware.kryo.util.DefaultClassResolver.readName(DefaultClassResolver.java:160) ...

trying to run a lambda that does a specql query

whitelisting...

we whitelisted clojure.core.* which is... brutal

that’s why clojure.core.specs.alpha$fn__24 didn’t made it to the other side of the net

@tatut btw really good job on SpecQL, when/if I can revisit DataFrames support in Powderkeg I will look at it in closer details

I’m going to push a tentative fix in a couple of minutes

@tatut ^^that’s for you

I’ll try it out

that seems to work

I tried by simply returning an (s/explain-str ::my-spec some-data) from the lambda and it worked fine

great success! I now have a lambda that does a specql query and outputs an HTML page with the results..

🐲 2

probably wouldn’t do this in production, I’m just doing a simple polling app for a dev meetup we are hosting next week

re: production, because of portkey being so alpha?

both that and using RDS from lambda, I don’t know if it’s a good idea

even with a connection pool?

I’m simply using a connection map without any connection pooling, that’ll do for this example

It seems it is a common use-case, so much so that AWS has a tutorial for it http://docs.aws.amazon.com/lambda/latest/dg/vpc-rds.html

so maybe that is ok for production use

Issue: it seems portkey can’t handle arguments with dashes in their names

had (defn answer [poll-id option-id]) and tried to mount with path “/answer?poll={poll-id}&option={option-id}” and got an exception about unmapped arguments

removing the dashes worked

in the python of example, connection is created on top level, so pooling/keeping connection alive for a while is ok idea

there was someone in audience that pointed me to Zappa (a python serverless library, haven't looked at it)

but neat to find out a reference for pg connection pool server such as pgbouncer in that post

thinking that we might be on kosher side of ideas

Achievement unlocked! :)

should I report to github issues that dash problem with argument names?

musing: thinking about a story for automatic stage switch for XCD (extreme continuous deployment)

and didn’t you also had an issue with an anon fn (a little birdie told me)

I didn’t try it, just asked if it was possible

that was quick

set the channel topic: Portkey: from REPL to Serverless in one call

It looks like portkey doesn’t support POST, i’m getting {"message":"Missing Authentication Token"} when trying to POST to a portkey URL

doing side effects with GET requests is suboptimal, any thoughts on how easily it could be added?

this should be more configurable: methods, input content-types etc.

tangentially related but: wouldn’t it be possible to mount a ring app? @viesti?

for a start having a :method option to mount!

I've seen some ring handler wrappers but I think they didn't get far

Hey, we have 2^7 commits! 🍾

🦜 2

possibly not enough aws synergy

please elaborate

aws has SAML and authorization lambda, existing ring auth mechanism might not fit, would have to see what ring middleware is actually useful

to figure out what should belong to mappings in the api gateway, what done by a lambda

hmm, where's the tweet on RDS lambda with Portkey? :)

could you put the :method and :content-type into the function metadata, so that it is colocated with the definition

I'm not opposed to. However in var or fn metadata it should be namespacesd.

yeah, something like (defn ^{::pk/content-type "text/html" ::pk/method :POST} foo [bar] ...)

started hacking post support, nothing working yet 😕