Skip to content

Commit

Permalink
fix: do not call JSON.parse on event.body (#89)
Browse files Browse the repository at this point in the history
This PR removes the `JSON.parse` call from `event.body`. This was causing issues when trying to invoke Lambda functions asynchronously with `async` set to `true` in a `serverless.yaml` config file. I'm not exactly sure why this doesn't cause issues when `async` is not set to `true`, but I tested these changes with `http` events (both `async: true` and `async: false`) and `httpApi` events and it seemed to work fine on both. Also, I believe the `verifyAndReceive` function internally handles both objects and strings anyway.
  • Loading branch information
ajschmidt8 authored Mar 9, 2022
1 parent 2c1b25c commit c8472ff
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8,476 deletions.
2 changes: 1 addition & 1 deletion lambda-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function lambdaFunction(probot, event, context) {
signature:
headersLowerCase["x-hub-signature-256"] ||
headersLowerCase["x-hub-signature"],
payload: JSON.parse(event.body),
payload: event.body,
});

return {
Expand Down
Loading

0 comments on commit c8472ff

Please sign in to comment.