Skip to content

Instantly share code, notes, and snippets.

@miensol
Created March 11, 2018 21:16
Show Gist options
  • Save miensol/605f10134e3a18381fc54e03f87f496a to your computer and use it in GitHub Desktop.
Save miensol/605f10134e3a18381fc54e03f87f496a to your computer and use it in GitHub Desktop.
// Alice.ts
import aws from 'aws-sdk';
export function main(event: any, context: any, callback: Function) {
new aws.Lambda().invoke({
FunctionName: process.env.BobFunction!,
Payload: JSON.stringify({message: "Hi!. I'm Alice."})
}, (error: Error, data: any) => {
const response = JSON.parse(data.Payload);
console.log('FromBob', error || response)
callback(error);
});
}
// Bob.ts
export function main(event: any, context: any, callback: any) {
console.log('FromAlice', event)
callback(null, {message: "Hi! I'm Bob. Nice to meet you!"});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment