Python call my AWS lambda from code with boto3 error Python call my AWS lambda from code with boto3 error json json

Python call my AWS lambda from code with boto3 error


The error is because of the following parameter:

ClientContext='None',

From the docs:

ClientContext (string) --

Using the ClientContext you can pass client-specific information to the Lambda function you are invoking. You can then process the client information in your Lambda function as you choose through the context variable. For an example of a ClientContext JSON, see PutEvents in the Amazon Mobile Analytics API Reference and User Guide .

The ClientContext JSON must be base64-encoded and has a maximum size of 3583 bytes.

You do not need the ClientContext parameter here at all. Simply invoke as follows:

response = client.invoke(    FunctionName='arn:aws:lambda:eu-west-1:13737373737:function:test',    LogType='None',    Payload=json.dumps(d))