Unknown options: --cli-binary-format

Unknown options: --cli-binary-format

Hello readers, in executing the previous article, you may have an Unknown options: --cli-binary-format, response.json so if an error of type

Unknown options: --cli-binary-format

or

wer.png Popups then, Then it is because you are using the AWS CLI v1 and should be using the newer AWS CLI v2.

Another error that you will see along with this is:

An error occurred (InvalidRequestContentException) when calling the Invoke operation: Could not parse request body into json: Could not parse payload into json: Unrecognized token 'eyJwYXRoIjoiJEdMAAAAIgfQo': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')

An example that fails on AWS CLI v1

aws lambda invoke --function-name YourFunction --cli-binary-format raw-in-base64-out --payload '{"yourKey":"yourValue"}'

To fix this error on AWS CLI v1

aws lambda invoke --function-name YourFunction --region eu-west-1 --payload '{"yourKey":"yourValue"}' response.json

How to fix this error by Upgrading to AWS CLI v2

You can follow the guide directly to upgrade your CLI from v1 to v2 here Migrating from AWS CLI version 1 to version 2 – AWS Command Line Interface (amazon.com)

The instructions run through platform specific upgrades migrations: AWS CLI version 2 migration instructions – AWS Command Line Interface (amazon.com)

Now check your AWS CLI version

aws --version