question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The default API Gateway setup don't include the raw body of a POST

See original GitHub issue
  • Expected behaviour:

It should be possible to use claudiajs (and caudia-api-builder) to deploy lambdas that expects the raw body of a POST request in a parameter.

  • Use case:

An use case for this is the signature verification on a Facebook Messenger Bot for example, that sends a signature for the raw body + a secret in the header (see https://developers.facebook.com/docs/messenger-platform/webhook-reference#security )

  • What actually happens:

The Body Mapping Template used by claudia is the one at https://github.com/claudiajs/claudia/blob/master/json-templates/apigw-params.txt that does not include the raw body, and the CLI don’t have an option to override that template with a different one.

  • Workaround

Either manually add the patch on the body mapping template at AWS website:

...
  "rawBody": "$util.escapeJavaScript($input.body).replace("\'", "'")",
...

Or patch the apigw-params.txt manually.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
gojkocommented, Jul 29, 2016

I wouldn’t count on just facebook needing this, so adding rawBody for application/json in general would be my preferred option.

0reactions
fczuardicommented, Jul 29, 2016

I’ve copy/pasted the previous test, hope it’s ok 😛

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Gateway mapping template and access logging variable ...
For methods that don't require an API key, this variable is null. ... read a name from the query string and then include...
Read more >
Do not send raw body to AWS Lambda via API Gateway
I have an aws lambda function written in node. I have a HTTP API in API Gateway which calls this lambda function.
Read more >
Accepting Raw Request Body Content in ASP.NET Core API ...
When posting raw body content to ASP.NET Core the process is not very self-explanatory. There's no easy way to simply retrieve raw data...
Read more >
Add a Request Body to a POST Request | API Connector
A content-type header describes the object's format, so the server knows how to parse it. The default content type will be application/x-www-form-urlencoded.
Read more >
How do I get an API Gateway REST API to pass query string ...
We appreciate your feedback: https://amazonintna.qualtrics.com/jfe/form/SV_3rahupaLjgcQJkWFor more details see the Knowledge Center article ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found