portkey

Portkey: from REPL to Serverless in one call
cgrand 2017-10-24T10:22:23.000161Z

@qqq ^^ test and report

viesti 2017-10-24T10:35:58.000205Z

one small step for man, but giant leap for Boot πŸ™‚

baptiste-from-paris 2017-10-24T10:36:19.000213Z

:bravetrue:

qqq 2017-10-24T10:57:51.000013Z

@cgrand: my clojure project does not build at the moment, but the moment it builds I'll switch to boot and test it out

qqq 2017-10-24T10:58:04.000028Z

thanks for tracking it down and fixint it

qqq 2017-10-24T11:05:38.000223Z

@cgrand confirmed to work for the following function

(defn sh []
     (str "trying again this time with boot function"))

cgrand 2017-10-24T11:06:17.000304Z

cool

qqq 2017-10-24T11:09:06.000279Z

I now have an issue where lambda is updated, api gateway is updated, but cloudfront is stilling calling the old version. This however, is no longer a portkey issue.

qqq 2017-10-24T11:10:37.000393Z

oh; I get it's a caching issue, caches probably assume that the return value of a GET request = does not change if URI does not change

viesti 2017-10-24T12:15:21.000291Z

hmm

viesti 2017-10-24T12:15:55.000129Z

probably maps to caching in Cloudfront, which I should actually use myself also

viesti 2017-10-24T12:16:05.000086Z

or learn to use that is

qqq 2017-10-24T12:29:32.000472Z

@viesti: I called up AWS Business Support and got it resolved. There's three ways to call a lambda: 1. via the lambda endpoint 2. via the API Gateway endpoint that stages the lambda 3. via the CloudFront 'behaviour' that routes to the API Gateway now, when I update a lambda, and call the same URI, there . is potential for caching 1 & 2 do not do caching 3 does do caching (by default, but you can turn caching off)

viesti 2017-10-24T12:30:23.000477Z

hmm so I don’t remember explicitly turning off caching

qqq 2017-10-24T12:32:11.000201Z

@viesti: are you accessing lambda via API Gateway or CloudFront ? API Gateway has caching off by default.

viesti 2017-10-24T12:33:03.000470Z

so I guess API Gateway

viesti 2017-10-24T12:33:15.000166Z

I though that API gateway is a facade over Cloudfront πŸ™‚

viesti 2017-10-24T12:33:23.000522Z

or thereabouts

cgrand 2017-10-24T12:33:52.000362Z

me too

qqq 2017-10-24T12:35:01.000519Z

Right, so according to the support engineer: If you use API Gateway end point (which uses CloudFront), caching is off by default. If you setup CloudFront separately (and create an origin [ppointing at API Gateway] + setup a Behaviour that points to origin), then Caching is on by default see: https://imgur.com/a/emNVY

qqq 2017-10-24T12:35:37.000108Z

The one thing I have not got a good answer on is -- why do I want lambda requests cached at all ?

qqq 2017-10-24T12:48:31.000442Z

=== Is there a way to control the name portkey uses?

(defn sh []
  (str "trying again this time with boot function"))

(pk/mount! sh "/")
results in a function of a Lambda name of:
/server_-snip_-aws_Ish
now, is there a way me to control what name is used on Lambda ?

qqq 2017-10-24T12:54:16.000010Z

I'm trying to call mount! as

(pk/mount! sh "/"
           :lambeda-function-name "api-live")
but it's not creating a lambda with name api-live

viesti 2017-10-24T13:02:31.000054Z

hmm, we don’t pass :lambda-function-name onwards from pk/mount! macro currently

viesti 2017-10-24T13:03:00.000351Z

or on line 656 could work

viesti 2017-10-24T13:03:59.000228Z

no, (make-lambda-function-name (meta ~var-f)) creates the name

viesti 2017-10-24T13:04:26.000381Z

should do grab from arguments of mount!

qqq 2017-10-24T13:04:30.000131Z

right, but it's in an (into ... )

qqq 2017-10-24T13:04:35.000425Z

so the arguments from mount! goes into opts

viesti 2017-10-24T13:04:40.000315Z

aa

qqq 2017-10-24T13:04:42.000383Z

which should overwrite it due to the (into ...) on that line

cgrand 2017-10-24T13:04:47.000418Z

@qqq you have an extra β€œe” in your snippet

qqq 2017-10-24T13:04:49.000423Z

except it's not working 😞

viesti 2017-10-24T13:04:57.000094Z

that too

cgrand 2017-10-24T13:05:00.000198Z

lambEda

qqq 2017-10-24T13:05:04.000163Z

@cgrand: (pk/mount! h2 "/" :lambda-function-name "live") isn't working either

qqq 2017-10-24T13:05:15.000047Z

but yes, valid typo

qqq 2017-10-24T13:05:37.000131Z

or rather, vaild point that I made a typo

qqq 2017-10-24T13:06:27.000366Z

wtf, it's working now ... somehow my aws console was outdated (despite me clicking on refresh)

qqq 2017-10-24T13:06:51.000241Z

for anyone digging through the lotgs, what I ended up using is:

(defn h2 []
  (str "trying again this time with boot function"))

(pk/mount! h2 "/" :lambda-function-name "live")

qqq 2017-10-24T13:12:53.000320Z

what is it with AWS limiting me on: * # of lambda I can post per minute * # of apis I can delete per minute (seems ot be set at 1)

viesti 2017-10-24T13:25:37.000482Z

have hit on the management limits myself also

qqq 2017-10-24T14:06:06.000155Z

They should make these limits "burstable" -- 29 days out of the month, I don't need to modify anything; but when I need to modify it, it's generally 5-10 changes I need to make.