From 054e773feb48392d28dc25849511db801d985522 Mon Sep 17 00:00:00 2001 From: Zhongwei Yao Date: Tue, 24 Oct 2023 05:45:01 -0700 Subject: [PATCH] fix(core): print error message correctly when plugin fails. (#11800) Before the fix, error message is: [kong] init.lua:405 [aws-lambda] table: 0x04183d70, client:127.0.0.1... After: [kong] init.lua:405 [aws-lambda] Function not found: arn:aws:lambda:us-east-1:xxx:function:test-lambda-2, client: 127.0.0.1... --- changelog/unreleased/kong/fix-error-message-print.yml | 3 +++ kong/plugins/aws-lambda/handler.lua | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/kong/fix-error-message-print.yml diff --git a/changelog/unreleased/kong/fix-error-message-print.yml b/changelog/unreleased/kong/fix-error-message-print.yml new file mode 100644 index 000000000000..c3e87303f08b --- /dev/null +++ b/changelog/unreleased/kong/fix-error-message-print.yml @@ -0,0 +1,3 @@ +message: print error message correctly when plugin fails +type: bugfix +scope: Core diff --git a/kong/plugins/aws-lambda/handler.lua b/kong/plugins/aws-lambda/handler.lua index 2e1b78002d03..78699df1d4ad 100644 --- a/kong/plugins/aws-lambda/handler.lua +++ b/kong/plugins/aws-lambda/handler.lua @@ -181,7 +181,7 @@ function AWSLambdaHandler:access(conf) local content = res.body if res.status >= 400 then - return error(content) + return error(content.Message) end -- TRACING: set KONG_WAITING_TIME stop