Created
March 11, 2018 21:16
-
-
Save miensol/605f10134e3a18381fc54e03f87f496a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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