Any modification of interaction response gateway matching patterns API Gateway causes 500 errors

I am in the Amazon API Gateway, and any change in the Mapping Patterns section of the integration response destroys the resource / method (causes Test to return an error) and cannot be fixed (you must remove the Resource / Method and create a new one).

  • I create a new resource and then create a new method (POST) under this.
  • I correlate this with a simple lambda function (it does not require any parameters and only returns / logs "hello").
  • I am testing this and it is succeeding.
  • I go to Integration Response, and I change the mapping patterns ... I change application/jsonto application/xml, and I change the Output Transit to the Cartographic Template.

I introduced this as a template:

#set($inputRoot = $input.path('$'))
<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Message>
        <Body>
            $inputRoot
        </Body>
    </Message>
</Response> 
  • , "".
  • ,

:

{
  "message": "Internal server error"
}

Logs ( [ ], , ):

Execution log for request test-request
Sun Dec 06 17:33:50 UTC 2015 : Starting execution for request: test-invoke-request
Sun Dec 06 17:33:50 UTC 2015 : API Key: test-invoke-api-key
Sun Dec 06 17:33:50 UTC 2015 : Method request path: {}
Sun Dec 06 17:33:50 UTC 2015 : Method request query string: {}
Sun Dec 06 17:33:50 UTC 2015 : Method request headers: {}
Sun Dec 06 17:33:50 UTC 2015 : Method request body before transformations: null
Sun Dec 06 17:33:50 UTC 2015 : Endpoint request URI: [lambda uri here]
Sun Dec 06 17:33:50 UTC 2015 : Endpoint request headers: {Authorization=[lots of * here], X-Amz-Date=20151206T173350Z, X-Amz-Source-Arn=[arn here], Accept=application/json, User-Agent=AmazonAPIGateway_[string here], Host=lambda.us-east-1.amazonaws.com}
Sun Dec 06 17:33:50 UTC 2015 : Endpoint request body after transformations: 
Sun Dec 06 17:33:50 UTC 2015 : Endpoint response body before transformations: "hi"
Sun Dec 06 17:33:50 UTC 2015 : Endpoint response headers: {x-amzn-Remapped-Content-Length=0, x-amzn-RequestId=[data here], Connection=keep-alive, Content-Length=12, Date=Sun, 06 Dec 2015 17:33:50 GMT, Content-Type=application/json}
Sun Dec 06 17:33:50 UTC 2015 : Execution failed due to configuration error: No match for output mapping and no default output mapping configured
Sun Dec 06 17:33:50 UTC 2015 : Method completed with status: 500
  • Response 200 application/json application/xml... .
  • ... application/json application/json 'Output passthrough'... - / API .

, 200 Response "application/json" "application/xml"... .

... " " " " application/json application/xml... .

, , Output Passthrough Mapping Template... , , , - / .

, , - AWS, "" -.

- , ? , , ...

​​ , . 18:35 12-05-2015, , / API Amazon...

+4
4

, , API Gateway, .

:

" " " ". , -, , , (2015-12-05).

+2

API. API-, , 500. CloudWatch : " - : ".

. , API.

, , AWS: https://forums.aws.amazon.com/thread.jspa?threadID=221197&tstart=0

, Jurgen

+1

. "", , .

. , .

0

. . API- , . .

0

Source: https://habr.com/ru/post/1618802/


All Articles