Truncated response while invoking Lambda function from Proxy using Lambda Extension

I am invoking a Lambda function from API proxy using Lambda extension as per attached text file.

I am getting a 200 status but the message is truncated as shown below:Response is captured using Connector.response.

{"statusCode":200,"logResult":"U1RBUlQgUmVxdWVzdElkOiAxZmExNzE0Ny0zZjI5LTRiNGUtYTE1YS02MTk1MzczM2VkZTEgVmVyc2lvbjogJExBVEVTVApFTkQgUmVxdWVzdElkOiAxZmExNzE0Ny0zZjI5LTRiNGUtYTE1YS02MTk1MzczM2VkZTEKUkVQT1JUIFJlcXVlc3RJZDogMWZhMTcxNDctM2YyOS00YjRlLWExNWEtNjE5NTM3MzNlZGUxCUR1cmF0aW9uOiAxMC40NCBtcwlCaWxsZWQgRHVyYXRpb246IDExIG1zCU1lbW9yeSBTaXplOiAxMjggTUIJTWF4IE1lbW9yeSBVc2VkOiA2NSBNQglJbml0IER1cmF0aW9uOiAxMjcuNzUgbXMJCg==","payload":"{\"statusCode\":200,\"body\":\"{\\\"firstName\\\":\\\"John\\\",\\\"l.....

Lambda function is as below:

exports.handler = async (event) => { const response = { statusCode:200, body:JSON.stringify({ "firstName": "John", "lastName" : "doe", "age" : 26, "phoneNumbers": [ { "type" : "iPhone", "number": "0123-4567-8888" }, { "type" : "home", "number": "0123-4567-8910" } ] }), }; return response };

However,if I simplify the Lambda function as below,I am able to get the response successfully.

exports.handler = async (event) => { const response = { statusCode:200, body:JSON.stringify('Hello from Lambda'), }; return response };

Questions:

1.Should Connector.response. be used to capture response or any other variable/property ?I do not see any request/response related flow variables in Trace of Extension Policy.

2.Is there any limitation on payload size ?

Please note that I am getting the complete response on executing the Lambda function from AWS within the prescribed time and memory settings.

0 1 952
1 REPLY 1

1. This doesn't look right. What's your <Output>variable-name</Output> tag configured to on your extension callout policy? What happens if you reference that variable instead?

2. Extensions payload responses of up to 2MB are supported ( https://docs.apigee.com/api-platform/reference/limits?hl=en ) but this is far larger than your test payload, so I don't think that's the issue here.