@@ -16,8 +16,7 @@ local VIA_HEADER = constants.HEADERS.VIA
1616local VIA_HEADER_VALUE = meta ._NAME .. " /" .. meta ._VERSION
1717
1818local request_util = require " kong.plugins.aws-lambda.request-util"
19- local AWS_Stream = require (" kong.plugins.aws-lambda.aws_stream" )
20- local invokeWithResponseStream = require " kong.plugins.aws-lambda.execute"
19+ local AWS_Stream = require (" resty.aws.stream" )
2120local build_request_payload = request_util .build_request_payload
2221local extract_proxy_response = request_util .extract_proxy_response
2322local remove_array_mt_for_empty_table = request_util .remove_array_mt_for_empty_table
@@ -170,7 +169,7 @@ local function invoke_streaming(conf, lambda_service)
170169 -- TRACING: set KONG_WAITING_TIME start
171170 local kong_wait_time_start = get_now ()
172171
173- local res , err = invokeWithResponseStream (lambda_service , {
172+ local res , err = lambda_service : invokeWithResponseStream ({
174173 FunctionName = conf .function_name ,
175174 InvocationType = conf .invocation_type ,
176175 LogType = conf .log_type ,
@@ -263,12 +262,10 @@ local function invoke_streaming(conf, lambda_service)
263262 end
264263
265264 -- print(require("pl.pretty").write(msg))
266- for _ , header in ipairs (msg .headers ) do
267- if header .key == " :event-type" and header .value == " PayloadChunk" then
268- -- print(msg.body)
269- ngx .print (msg .body )
270- ngx .flush (true )
271- end
265+ if msg .headers [" :event-type" ] == " PayloadChunk" then
266+ -- print(msg.body)
267+ ngx .print (msg .body )
268+ ngx .flush (true )
272269 end
273270 end
274271 end
0 commit comments