Home > OS >  AWS CLI dollar sign '$' escaping when invoking lambda function
AWS CLI dollar sign '$' escaping when invoking lambda function

Time:01-24

there! I got little problem invoking aws lambda function from cli on Windows, my invocation code looks like this

aws lambda invoke --function-name blah-blah-event-generator --cli-binary-format raw-in-base64-out --payload '{\"UserName\": \"blah-blah\", \"Pwd\": \"blah$$blah\", \"Operation\": \"blah\"}' response.json

And this error occurs

An error occurred (InvalidRequestContentException) when calling the Invoke operation: Could not parse request body into json: Could not parse payload into json: Unrecognized character escape '$' (code 36)

To overcome this problem I tried to add '' symbol before dollar signs but nothing changes:

aws lambda invoke --function-name blah-blah-event-generator --cli-binary-format raw-in-base64-out --payload '{\"UserName\": \"blah-blah\", \"Pwd\": \"blah\$\$blah\", \"Operation\": \"blah\"}' response.json

CodePudding user response:

On Windows you need to use double quotation mark (") for the payload parameter. The $ is not generating any problem.

Try with this command (I have taken the first command and changed ' by "):

aws lambda invoke --function-name blah-blah-event-generator --cli-binary-format raw-in-base64-out --payload "{\"UserName\": \"blah-blah\", \"Pwd\": \"blah$$blah\", \"Operation\": \"blah\"}" response.json
  •  Tags:  
  • Related