yes
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
thanks
I’m going to push a tentative fix in a couple of minutes
oh cool
@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..
against RDS?
yes
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
my specql using lambda: https://3ekj3mh91k.execute-api.eu-central-1.amazonaws.com/repl/results?poll=1
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)
@tatut yes please
will do
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
@tatut thanks
that was quick
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?
@tatut it’s hardcoded atm https://github.com/portkey-cloud/portkey/blob/master/src/main/clojure/portkey/aws.clj#L21
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! 🍾
why? 🐲s?
possibly not enough aws synergy
please elaborate
on post, have to see if request template needs change https://github.com/portkey-cloud/portkey/blob/a93e3d012a0aaa6a3d8e1998fc8a02dbcd21b08d/src/main/clojure/portkey/aws.clj#L47
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? :)
ah, found it
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] ...)
That's it
started hacking post support, nothing working yet 😕