Fork me on GitHub
#portkey
<
2017-09-04
>
tatut12:09:45

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

tatut12:09:07

trying to run a lambda that does a specql query

cgrand12:09:19

whitelisting...

cgrand12:09:04

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

cgrand12:09:47

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

cgrand12:09:01

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

cgrand13:09:17

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

cgrand13:09:48

@tatut ^^that’s for you

tatut13:09:26

I’ll try it out

tatut13:09:25

that seems to work

tatut13:09:56

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

tatut13:09:38

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

cgrand13:09:54

against RDS?

tatut13:09:57

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

cgrand13:09:05

re: production, because of portkey being so alpha?

tatut13:09:42

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

cgrand13:09:20

even with a connection pool?

tatut13:09:51

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

tatut13:09:31

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

tatut13:09:42

so maybe that is ok for production use

tatut13:09:18

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

tatut13:09:00

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

tatut13:09:08

removing the dashes worked

viesti13:09:02

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

viesti13:09:46

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

viesti13:09:27

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

viesti14:09:27

Achievement unlocked! :)

tatut14:09:50

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

cgrand14:09:00

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

cgrand14:09:39

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

tatut14:09:51

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

tatut14:09:15

that was quick

tatut15:09:23

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

tatut15:09:52

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

cgrand15:09:58

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

cgrand15:09:06

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

cgrand15:09:07

for a start having a :method option to mount!

viesti15:09:38

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

cgrand15:09:50

Hey, we have 2^7 commits! 🍾

cgrand15:09:26

why? 🐲s?

viesti15:09:07

possibly not enough aws synergy

cgrand15:09:13

please elaborate

viesti16:09:14

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

viesti16:09:11

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

viesti16:09:13

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

viesti16:09:53

ah, found it

tatut16:09:48

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

cgrand17:09:43

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

tatut17:09:13

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

viesti20:09:19

started hacking post support, nothing working yet 😕