These are chat archives for jdubray/sam

8th
May 2016
Jean-Jacques Dubray
@jdubray
May 08 2016 08:59
@devinivy so thinking a bit more about the "Create/Update/Delete" case and it looks like the benefits of making that action cancellable completely outweigh the drawbacks. You actually "cannot" cancel a save operation once it has been initiated, you have to issue a compensating action (not even revert to the previous' step application step would do it). Once a POST/PUT/DELETE operation has been invoked, you can only issue another one which will have the effect of reverting the save. So I guess it is safe to put these operations in the model, it's probably the safest place for them to be.
This message was deleted
Jean-Jacques Dubray
@jdubray
May 08 2016 09:04
This message was deleted
Jean-Jacques Dubray
@jdubray
May 08 2016 13:50
Just found an Interesting error message from AWS DynamoDB:
    "Request.emit (/var/task/node_modules/aws-sdk/lib/request.js:615:14)",
    "Request.transition (/var/task/node_modules/aws-sdk/lib/request.js:22:10)",
    "AcceptorStateMachine.runTo (/var/task/node_modules/aws-sdk/lib/state_machine.js:14:12)",
devin ivy
@devinivy
May 08 2016 14:26
yup! i noticed their use of state machines in the sdk once. i think it's open-source, so you could check-out what they're up to :)
Jean-Jacques Dubray
@jdubray
May 08 2016 14:26
I got SAM to work with AWS Lambda + DynamoDB, I should publish the code momentarilly
devin ivy
@devinivy
May 08 2016 14:26
does CRUD in the model undermine the idea of reusable/distributable actions? i need to think about this and see/write some examples.
Jean-Jacques Dubray
@jdubray
May 08 2016 14:26
Apologies, I am really excited about that particular implementation
devin ivy
@devinivy
May 08 2016 14:27
cool! :) look forward to checking it out
Jean-Jacques Dubray
@jdubray
May 08 2016 14:27
Well, I would argue that the model + persistence kind of hang together
The reusable ones would be like "change Address" which consume a 3rd party API
For the AWS code, I took SAFE as is, added a DynamoDB session manager and simply converted the Express code to Claudia API builder and that was it.
Jean-Jacques Dubray
@jdubray
May 08 2016 19:36
SAM-SAFE v0.7.0 has been published with support for AWS Lambda and a DynamoDB session manager
Jean-Jacques Dubray
@jdubray
May 08 2016 20:21
Again, super excited to publish perhaps the first Lambda implementation of the SAM pattern
https://github.com/jdubray/sam-samples/tree/master/crud-blog-lambda
This is Isomorphism to the nth degree, the same action/model/state/view can be reused "as is" in the browser, deployed in node.js or in Lambda.
The server.js file is generic, it can be used to "Lambda-ify" any of your SAM implementation !!
weepy
@weepy
May 08 2016 20:54
What is Lambda?
Oh
Lambda is a compute service where you can upload your code to AWS Lambda and the service can run the code on your behalf using AWS infrastructure.
Jean-Jacques Dubray
@jdubray
May 08 2016 21:58
yes, you pay by the request it's like $0.20 per 1 M request .... infinitely scalable, 100% available.
I was a bit surprised by the latency, I would think this would be zipping (specially considering the Lambda itself runs in under 100ms) but it looks like API Gateway or the network is making look a bit slow
The other gotcha is that AWS keeps your lambda around... so if your implementation is "stateful" you'll find all your state right there on the second / subsequent requests. Hilarious if you ask me.