diff --git a/lib/plugins/aws/deploy/compile/events/apiGateway/lib/methods.js b/lib/plugins/aws/deploy/compile/events/apiGateway/lib/methods.js index 70b36d0e5..521925868 100644 --- a/lib/plugins/aws/deploy/compile/events/apiGateway/lib/methods.js +++ b/lib/plugins/aws/deploy/compile/events/apiGateway/lib/methods.js @@ -99,19 +99,19 @@ module.exports = { "method": "$context.httpMethod", "principalId": "$context.authorizer.principalId", "stage": "$context.stage", - + #set( $map = $input.params().header ) "headers": $loop, - + #set( $map = $input.params().querystring ) "query": $loop, - + #set( $map = $input.params().path ) "path": $loop, - + #set( $map = $context.identity ) "identity": $loop, - + #set( $map = $stageVariables ) "stageVariables": $loop } @@ -331,7 +331,9 @@ module.exports = { { StatusCode: 403, SelectionPattern: '.*\\[403\\].*' }, { StatusCode: 404, SelectionPattern: '.*\\[404\\].*' }, { StatusCode: 422, SelectionPattern: '.*\\[422\\].*' }, - { StatusCode: 500, SelectionPattern: '.*\\[500\\].*' }, + { StatusCode: 500, + SelectionPattern: + '.*(Process\\s?exited\\s?before\\s?completing\\s?request|\\[500\\]).*' }, { StatusCode: 502, SelectionPattern: '.*\\[502\\].*' }, { StatusCode: 504, SelectionPattern: '.*\\[504\\].*' } ); diff --git a/lib/plugins/aws/deploy/compile/events/apiGateway/tests/methods.js b/lib/plugins/aws/deploy/compile/events/apiGateway/tests/methods.js index ec09c88a1..563eb5053 100644 --- a/lib/plugins/aws/deploy/compile/events/apiGateway/tests/methods.js +++ b/lib/plugins/aws/deploy/compile/events/apiGateway/tests/methods.js @@ -664,7 +664,8 @@ describe('#compileMethods()', () => { expect( awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate .Resources.ApiGatewayMethodUsersListGet.Properties.Integration.IntegrationResponses[6] - ).to.deep.equal({ StatusCode: 500, SelectionPattern: '.*\\[500\\].*' }); + ).to.deep.equal({ StatusCode: 500, + SelectionPattern: '.*(Process\\s?exited\\s?before\\s?completing\\s?request|\\[500\\]).*' }); expect( awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate .Resources.ApiGatewayMethodUsersListGet.Properties.Integration.IntegrationResponses[7]