エラー string argument should contain only ASCII characters
AWS Lambda を aws コマンドで実行したら、以下のエラーが出た。
$ aws lambda invoke --function-name myfunction:V1 --invocation-type RequestResponse --payload '{"foo":"あいうえお"}' /dev/stdout string argument should contain only ASCII characters
どうやら日本語を payload に含めているとだめなようだった。
aws コマンドの共通引数の --cli-binary-format に raw-in-base64-out を指定するとうまくいった。
$ aws --cli-binary-format raw-in-base64-out lambda invoke --function-name myfunction:V1 --invocation-type RequestResponse --payload '{"foo":"あいうえお"}' /dev/stdout { "StatusCode": 200, "ExecutedVersion": "$LATEST" }
参考: