Skip to content

4.0.6 > 4.1.0 broke the JSON parsing of lambda functions invoked via Stonebranch Lambda plugin #1135

@srunnoe

Description

@srunnoe

The following commit

8a93e10#diff-c3541839d4b70d7bf7b3c116f62949cdab0fd8923e1ccf57a6788e6411d67d87

added

	MessageBuilder builder = MessageBuilder.withPayload(structMessage instanceof Map msg && msg.containsKey("payload") 
			? ((String) msg.get("payload")).getBytes(StandardCharsets.UTF_8) 
					: payload);

To the org/springframework/cloud/function/adapter/aws/AWSLambdaUtils.java class.

Which breaks when the https://stonebranchdocs.atlassian.net/wiki/spaces/UE/pages/6062516/AWS+Lambda plugin sends the following JSON payload to the lambda. The plugin allows you to send any text string you like within the payload section.

{
    "payload": {
        "headers": {
            "businessUnit": "1"
        }
    },
    "headers": {
        "aws-context": {
            "memoryLimit": 1024,
            "awsRequestId": "87a211bf-540f-4f9f-a218-d096a0099999",
            "functionName": "myfunction",
            "functionVersion": "278",
            "invokedFunctionArn": "arn:aws:lambda:us-east-1:xxxxxxx:function:xxxxx:snapstart",
            "deadlineTimeInMs": 1712717704761,
            "logger": {
                "logFiltering": {
                    "minimumLogLevel": "UNDEFINED"
                },
                "logFormatter": {},
                "logFormat": "TEXT"
            }
        },
        "businessUnit": "1",
        "id": "xxxx",
        "aws-event": true,
        "timestamp": 1712716805129
    }
}

When I upgraded to the 4.1.0 instance from the previous 4.0.6 it broke the invocation of the lambda. Please explain why the new payload section of code was added and remove if not needed.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions