[英]AWS API Gateway Lambda Error Regex
我有用Python 2.7編寫的Lambda函數,該函數是從API Gateway觸發的,
我希望當Lambda失敗並且我不想使用Lambda代理時API Gateway返回400代碼,所以我試圖設置API Gateway Integration Response。
當Lambda函數失敗時,它返回:
{
"stackTrace": [
[
"/var/task/lambda_function.py",
12,
"lambda_handler",
"raise Exception('failure')"
]
],
"errorType": "Exception",
"errorMessage": "failure"
}
..與CLI相同:
aws apigateway get-integration-response --rest-api-id bz47krygwa --resource-id 788q0w --http-method ANY --status-code 400 --region us-west-1
{
"statusCode": "400",
"selectionPattern": ".*\"failure\".*",
"responseTemplates": {
"application/json": "#set($inputRoot = $input.path('$.errorMessage'))\n$inputRoot"
}
}
有任何修復建議嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.