Skip to content

Commit

Permalink
Add guard to ensure that body is non null
Browse files Browse the repository at this point in the history
TypeScript was complianing a little later on when we tried to
Buffer.from `event.body` since it may be null.
  • Loading branch information
ellismg committed Apr 18, 2019
1 parent 0711e55 commit d8a958c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aws-ts-slackbot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const endpoint = new awsx.apigateway.API("mentionbot", {
throw new Error("mentionbot:verificationToken was not provided")
}

if (!event.isBase64Encoded) {
if (!event.isBase64Encoded || event.body == null) {
console.log("Unexpected content received");
console.log(JSON.stringify(event));
}
Expand Down

0 comments on commit d8a958c

Please sign in to comment.