It is a well known fact that compile-time errors during development are easier and cheaper to catch than runtime ones in production. Unfortunately people keep forgetting that simple fact. Let me tell you a little story about AWS Lambda hiccup, and how it could easily be avoided.
A developer wrote a simple Lambda function in TypeScript that would receive a parameter of the following type:
interface Notification { slack?: { notify: boolean }; github?: { notify: boolean }; }
The logic is simple – if slack.notify
is true
– send slack notification. If github.notify
is true
– send github commit status notification. The function deployed without issues, and it does send slack notifications. There is one problem: often it would send the same slack notification 3 times in a row. Continue reading →