Wednesday, November 11, 2020

SNS HTTPS Fanout to API Gateway Error

 In one of my projects, I have an Amazon SNS subscription set up to fan out to HTTPS endpoint that is backed by Amazon API Gateway. The API Gateway has mapping template applied. 

Problem

It went smoothly during test with Postman and the API Gateway test, but when SNS sends the Notification message, it threw an error. On CloudWatch log, the error message is:

Execution failed: null

Solution

Apparently SNS sends request with Content-Type of text/plain although the request body contains json while I only had mapping set for application/json. So adding mapping template for text/plain solves my problem.



No comments:

Post a Comment