Fork me on GitHub
#aws-lambda
<
2017-02-21
>
fingertoe00:02:51

@andre.richards I have built an Alexa Skill on Node.. It isn’t too hard. I started with https://github.com/nervous-systems/cljs-lambda and just gutted it to return the appropriate JSON..

fingertoe00:02:12

My app runs extensive Podcast Alexa app. The hardest part is the lack of an easy workflow.

andre.richards01:02:40

I also started with cljs-lambda, and got a basic Lambda function deployed on Amazon - but I don't know how to call the Alexa code, as I'm brand new to ClojureScript

fingertoe01:02:38

I didn’t use any of the SDK stuff. Alexa sends you JSON. You parse it and return JSON, it works like a charm. If you want to host it yourself on your own server the SDK has some security libraries that would be handy - but if you are using Lambda they don’t require all that..

fingertoe02:02:16

I will put together a GIST real quick...

fingertoe03:02:04

Troubleshooting the lambda alexa apps is a bit tricky. The cloudwatch logs usually give you more detail than the Skills kit test app does- Printing to the console log is helpful. those show up in cloudwatch.. The workflow just stinks - because there isn’t much escaping the need to compile/upload/test..

mobileink20:02:04

fingertoe: fwiw, with boot-ask you can test your speechlet locally using gae devserver. once everything is copacetic, you can switch to aws-lambda without changing your code.

andre.richards11:02:29

@fingertoe thanks for that! I'll give it a go a little later today.

andre.richards19:02:41

@fingertoe thanks that works great. Much nicer not having to deal with a layer of JavaScript in between. Just work with data in ClojureScript.

andre.richards19:02:22

Regarding troubleshooting - yep is a bit of a pain, but once the basic thing works, it is possible to test locally to check that certain input returns the correct output at least

fingertoe19:02:06

Good deal! I would like to set up a lein template or something for that — I am a pretty new developer, and have never done something like that - but I think it might be time..

mj_langford19:02:32

This cljs seems better but clj has better tools thing seems a theme on lambda 😃

fingertoe19:02:17

The “Listen for this and say that” troubleshooting is pretty easy in your REPL it’s the “listen for this, Poke and prod a foreign API and reply with the results” gets a little hairy. What works on the REPL doesn’t aways work the same on Lambda..

fingertoe20:02:19

@mj_langford I find the need to use a lot more interop on ClojureScript.. Since I never was a JavaScript Developer to start with, that is un-fun. It does get the job done though.

mj_langford20:02:02

Yeah, Clojurescript is partially my thing so I don't have to keep up with the 5 changes a week js ecosystem

mobileink20:02:14

hi guys. just out of curiosity, why clojurescript? why not clojure?

mobileink20:02:53

mainly startup time?

mobileink20:02:34

for ask, i mean.

fingertoe20:02:43

Cool — boot-ask eh? Haven’t played with that.

fingertoe20:02:43

That looks Very cool! thanks!

mobileink21:02:35

see https://github.com/migae/boot-ask. warning: not battle-tested. you'd be a beta tester. feedback warmly welcomed. also, clojure, not clojurescript.

mobileink21:02:49

one thing i need to document for noobs: in the examples at https://github.com/migae/boot-ask-examples, notice`gae.boot` and lambda.boot. copy the one you want to 'build.boot'.

mobileink21:02:04

i use gae.boot for local testing (using upload.sh, suitably edited), and then cp lambda.boot to build.boot when i'm ready to upload and test on aws lambda.

fingertoe21:02:47

@mobileink That runs java, not Node, right? You have to poke it to evade the warm up time?

mj_langford21:02:51

startuptime is horrrrrrrible mobileink in lambda

mj_langford21:02:56

you have to keepalive the instances

mj_langford21:02:23

AWS gateway used to have a 10 sec timeout

mj_langford21:02:29

which was too short for startup

mobileink21:02:43

ok. we do not speak of that around here. 😉

mobileink21:02:50

@fingertoe: because i am a pedant, I'll quote the great Knuth: premature optimization is the root of all evil. simple_smile

mobileink21:02:31

so fwiw, a goal of boot-ask is to optimize programming. on the theory that stuff like startup times can always be dealt with later. it's an orthogonal consideration. (of course, i do not have any sites up that need fast startup, but who's counting?)

mobileink21:02:07

anyway, there are always tradeoffs. startup time is just one consideration. once you're started, i'm guessing, java is much faster. but that's just a guess.

fingertoe21:02:49

I think running Alexa skills on your own server with Java would be the ideal setup — Nodejs on Lambda is plenty fast for most things you would use Alexa for.. I did my app with NodeJS to evade startup time issues.. Haven’t tried it the other way - but that was my worry.

mobileink21:02:34

simple example: you can always present a fast static splash page while your servlets are starting up. by the time your user clicks, the stuff is up and ready. point being there are many optimization techniques, but they should not be allowed to leak into code.

mobileink21:02:02

@fingertoe : yeah. if you run your own speechlet server you are totally in control. fwiw when i have run speechlets on gae the first time thru is a problem. but then you just say "Alexa... " again and all is fine. and this is with no optimizations at all.

mobileink21:02:05

even "native " alexa cmds often require repetition.

fingertoe21:02:08

I am pretty happy with how the my Clojurescript Alexa app turned out— It responds immediately the first time every time. I would prefer to have a framework like the boot-ask though - that looks mighty cool.

mobileink21:02:14

thx. hey, if you want to help make it go with clojurescript fire away!

mobileink21:02:30

fwiw i am not anti-clojurescript, just do not have much experience with it. and node etc. give me the heebie-jeebies.

mobileink21:02:17

quibble: not a framework! just another lib. 😉

mobileink21:02:28

ok, cljs-lambda is on my list. next time i have time to work on boot-ask i'll take axlong look. thanks

fingertoe21:02:33

There was plenty of pain — I have never done and Node or JS… Mostly just annoyances though.. cljs-http didn’t work on node, so I had to do all my stuff with js interop etc..

mobileink21:02:18

cljs-lambda looks interesting.

mobileink22:02:47

but my unsolicited advice is to spend some serious time looking into boot. i love leinengen, but it must be said that boot is in an entirely different league.

mobileink22:02:30

Sadly, i've gotten to the point where i don't even look at projects that start out with leiningen.

fingertoe22:02:33

I have quite tempted by boot for quite some time. The truth is that I don’t really have a good grasp on either, but lein is what I have already used, and usually I am more focused on my problem than my tools.. I am sure I will make the jump soon enough .;-)

andre.richards22:02:37

@mobileink I read an article recently about JVM vs Node startup times and memory usage on Amazon Lambda - unsurprisingly JVM had slower startup, and required much more memory, but once running was faster (can't find the article now, will have another look). Thing is, I was doing the Alexa thing as a hobby project, something I might use from time to time, but not a professional project I expected many to use . The infrequent hits, would definitely make startup time more critical, and also JVM at suggested RAM of 512 makes it more expensive. So that was really my motivation for wanting to use ClojureScript - even though I'm unfamiliar with ClojureScript & JS & Node.