Errors and Invoking Function Always Returns :errorMessage "Your magic word is garbage"
JimLynchCodes opened this issue · 4 comments
I have set up the aws cli and configured the user role. However, when I invoke the function it always returns ":errorMessage "Your magic word is garbage""
I run lein cljs-lambda invoke work-magic '{"spell": "delay-promise", "msecs": 500, "magic-word": "my-lambda-project-token"}'
output:
aws lambda invoke /var/folders/41/b5ntx4mn2mv9qk3jyxnsnk_w0000gn/T/lambda-output7320674589193443835.json --function-name work-magic --payload {"spell": "delay-promise", "msecs": 500, "magic-word": "my-lambda-project-token"} --log-type Tail --query LogResult --output text
START RequestId: e92005f3-b9f7-11e7-9c52-0d9eab9ceec1 Version: $LATEST
2017-10-26T02:46:49.182Z e92005f3-b9f7-11e7-9c52-0d9eab9ceec1 {"errorMessage":"Your magic word is garbage","errorType":"Error","stackTrace":["Function. (/var/task/target/mylambylam/mylambylam/core.cljs:41:12)","Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$2 (/var/task/target/mylambylam/cljs/core.cljs:3566:18)","cljs$core$apply (/var/task/target/mylambylam/cljs/core.cljs:3557:1)","/var/task/target/mylambylam/cljs_lambda/util.cljs:40:24","promesa.impl.proto._promise.function (/var/task/target/mylambylam/promesa/impl/promise.cljc:199:8)","promesa$impl$proto$_promise (/var/task/target/mylambylam/promesa/impl/proto.cljc:41:1)","promesa$core$promise (/var/task/target/mylambylam/promesa/core.cljc:71:4)","Function.cljs_lambda.util.invoke_async.cljs$core$IFn$_invoke$arity$variadic (/var/task/target/mylambylam/cljs_lambda/util.cljs:36:4)","cljs_lambda$util$invoke_async (/var/task/target/mylambylam/cljs_lambda/util.cljs:35:1)","/var/task/target/mylambylam/cljs_lambda/util.cljs:110:15","cljs_lambda.util.wrap_lambda_fn.G__12212__delegate (/var/task/target/mylambylam/cljs_lambda/util.cljs:25:6)","cljs_lambda.util.wrap_lambda_fn.G__12212 (/var/task/target/mylambylam/cljs_lambda/util.cljs:20:3)","invoke (/var/runtime/node_modules/awslambda/index.js:288:5)","InvokeManager.start (/var/runtime/node_modules/awslambda/index.js:150:9)","Object. (/var/runtime/node_modules/awslambda/index.js:482:52)"]}
END RequestId: e92005f3-b9f7-11e7-9c52-0d9eab9ceec1
REPORT RequestId: e92005f3-b9f7-11e7-9c52-0d9eab9ceec1 Duration: 390.49 ms Billed Duration: 400 ms Memory Size: 128 MB Max Memory Used: 71 MB
{:errorMessage "Your magic word is garbage",
:errorType "Error",
:stackTrace
["Function. (/var/task/target/mylambylam/mylambylam/core.cljs:41:12)"
"Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$2 (/var/task/target/mylambylam/cljs/core.cljs:3566:18)"
"cljs$core$apply (/var/task/target/mylambylam/cljs/core.cljs:3557:1)"
"/var/task/target/mylambylam/cljs_lambda/util.cljs:40:24"
"promesa.impl.proto._promise.function (/var/task/target/mylambylam/promesa/impl/promise.cljc:199:8)"
"promesa$impl$proto$_promise (/var/task/target/mylambylam/promesa/impl/proto.cljc:41:1)"
"promesa$core$promise (/var/task/target/mylambylam/promesa/core.cljc:71:4)"
"Function.cljs_lambda.util.invoke_async.cljs$core$IFn$_invoke$arity$variadic (/var/task/target/mylambylam/cljs_lambda/util.cljs:36:4)"
"cljs_lambda$util$invoke_async (/var/task/target/mylambylam/cljs_lambda/util.cljs:35:1)"
"/var/task/target/mylambylam/cljs_lambda/util.cljs:110:15"
"cljs_lambda.util.wrap_lambda_fn.G__12212__delegate (/var/task/target/mylambylam/cljs_lambda/util.cljs:25:6)"
"cljs_lambda.util.wrap_lambda_fn.G__12212 (/var/task/target/mylambylam/cljs_lambda/util.cljs:20:3)"
"invoke (/var/runtime/node_modules/awslambda/index.js:288:5)"
"InvokeManager.start (/var/runtime/node_modules/awslambda/index.js:150:9)"
"Object. (/var/runtime/node_modules/awslambda/index.js:482:52)"]}
You're successfully invoking the function, as per https://github.com/nervous-systems/cljs-lambda#get-started the default is project-name-token for the magic word argument. See https://github.com/nervous-systems/cljs-lambda/blob/master/example/src/example/core.cljs for the implementation.
The function doesn't do anything particularly interesting, it's just an example of using a config file and handling errors / asynchronous responses.
Right, but when I invoke it with the correct password:
mylambylam ♘ lein cljs-lambda invoke work-magic '{"spell": "delay-promise", "msecs": 500, "magic-word": "my-lambda-project-token"}'
it still defaults back to the default magic word and gives me garbage word errors:
aws lambda invoke /var/folders/41/b5ntx4mn2mv9qk3jyxnsnk_w0000gn/T/lambda-output7320674589193443835.json --function-name work-magic --payload {"spell": "delay-promise", "msecs": 500, "magic-word": "my-lambda-project-token"} --log-type Tail --query LogResult --output text
@moea Here is an example using the correct token, but it still returns garbage magic word:
mylambylam ♘ lein cljs-lambda invoke work-magic '{"spell": "delay-promise", "msecs": 500, "magic-word": "jims-first-cljs-lambda-token"}'
aws lambda invoke /var/folders/41/b5ntx4mn2mv9qk3jyxnsnk_w0000gn/T/lambda-output6758579018630051305.json --function-name work-magic --payload {"spell": "delay-promise", "msecs": 500, "magic-word": "jims-first-cljs-lambda-token"} --log-type Tail --query LogResult --output text
START RequestId: 4f6a72c3-ba47-11e7-8065-5bad8c4ff975 Version: $LATEST
2017-10-26T12:15:09.761Z 4f6a72c3-ba47-11e7-8065-5bad8c4ff975 {"errorMessage":"Your magic word is garbage","errorType":"Error","stackTrace":["Function.<anonymous> (/var/task/target/mylambylam/mylambylam/core.cljs:41:12)","Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$2 (/var/task/target/mylambylam/cljs/core.cljs:3566:18)","cljs$core$apply (/var/task/target/mylambylam/cljs/core.cljs:3557:1)","/var/task/target/mylambylam/cljs_lambda/util.cljs:40:24","promesa.impl.proto._promise.function (/var/task/target/mylambylam/promesa/impl/promise.cljc:199:8)","promesa$impl$proto$_promise (/var/task/target/mylambylam/promesa/impl/proto.cljc:41:1)","promesa$core$promise (/var/task/target/mylambylam/promesa/core.cljc:71:4)","Function.cljs_lambda.util.invoke_async.cljs$core$IFn$_invoke$arity$variadic (/var/task/target/mylambylam/cljs_lambda/util.cljs:36:4)","cljs_lambda$util$invoke_async (/var/task/target/mylambylam/cljs_lambda/util.cljs:35:1)","/var/task/target/mylambylam/cljs_lambda/util.cljs:110:15","cljs_lambda.util.wrap_lambda_fn.G__12212__delegate (/var/task/target/mylambylam/cljs_lambda/util.cljs:25:6)","cljs_lambda.util.wrap_lambda_fn.G__12212 (/var/task/target/mylambylam/cljs_lambda/util.cljs:20:3)","invoke (/var/runtime/node_modules/awslambda/index.js:288:5)","InvokeManager.start (/var/runtime/node_modules/awslambda/index.js:150:9)"]}
END RequestId: 4f6a72c3-ba47-11e7-8065-5bad8c4ff975
REPORT RequestId: 4f6a72c3-ba47-11e7-8065-5bad8c4ff975 Duration: 104.77 ms Billed Duration: 200 ms Memory Size: 128 MB Max Memory Used: 71 MB
{:errorMessage "Your magic word is garbage",
:errorType "Error",
:stackTrace
["Function.<anonymous> (/var/task/target/mylambylam/mylambylam/core.cljs:41:12)"
"Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$2 (/var/task/target/mylambylam/cljs/core.cljs:3566:18)"
"cljs$core$apply (/var/task/target/mylambylam/cljs/core.cljs:3557:1)"
"/var/task/target/mylambylam/cljs_lambda/util.cljs:40:24"
"promesa.impl.proto._promise.function (/var/task/target/mylambylam/promesa/impl/promise.cljc:199:8)"
"promesa$impl$proto$_promise (/var/task/target/mylambylam/promesa/impl/proto.cljc:41:1)"
"promesa$core$promise (/var/task/target/mylambylam/promesa/core.cljc:71:4)"
"Function.cljs_lambda.util.invoke_async.cljs$core$IFn$_invoke$arity$variadic (/var/task/target/mylambylam/cljs_lambda/util.cljs:36:4)"
"cljs_lambda$util$invoke_async (/var/task/target/mylambylam/cljs_lambda/util.cljs:35:1)"
"/var/task/target/mylambylam/cljs_lambda/util.cljs:110:15"
"cljs_lambda.util.wrap_lambda_fn.G__12212__delegate (/var/task/target/mylambylam/cljs_lambda/util.cljs:25:6)"
"cljs_lambda.util.wrap_lambda_fn.G__12212 (/var/task/target/mylambylam/cljs_lambda/util.cljs:20:3)"
"invoke (/var/runtime/node_modules/awslambda/index.js:288:5)"
"InvokeManager.start (/var/runtime/node_modules/awslambda/index.js:150:9)"]}
cat static/config.edn
- what do you see?