nervous-systems / cljs-lambda

Utilities around deploying Clojurescript functions to AWS Lambda
The Unlicense
311 stars 34 forks source link

Cannot deploy twice #110

Open conan opened 5 years ago

conan commented 5 years ago

The second time I run lein cljs-lambda deploy I always get this error:

Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('X' (code 88)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

The unexpected character in question is always the first character of the output from the previous aws lambda get-function-configuration command:

aws lambda get-function-configuration --function-name referralbot-slash-command
XlWc1<snip>Omy8=    905749          arn:aws:lambda:eu-west-1:1<snip>4:function:referralbot-slash-command        referralbot-slash-command       index.referralbot_core_SLASH_slash_command      2018-09-27T11:43:22.641+0000    128     arn:aws:iam::1<snip>4:rol
                        nodejs4.3       3       $LATEST

I've tried running the aws configure command as suggested in #99, and have tried re-installing it too, but it didn't help. Here's the full stack trace. At the moment I have to delete the function in Lambda before lein cljs-lambda deploy will work again, which isn't an ideal workflow. Any ideas?

aws --version
aws-cli/1.11.13 Python/3.5.2 Linux/4.4.0-17134-Microsoft botocore/1.4.70
conan commented 5 years ago

OK, just noticed that cheshire is mentioned in the output and therefore figured out that cljs-lambda requires aws configure to have the output set to json rather than text.

I've sent a PR to mention this in the docs.

moea commented 5 years ago

https://github.com/nervous-systems/cljs-lambda/blob/master/plugin/src/leiningen/cljs_lambda/aws.clj#L143 should rather do(->cli-args {:name name :output "json"})