nervous-systems / cljs-lambda

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

Lambda won't run when all functions were deployed at once #40

Closed zrzka closed 8 years ago

zrzka commented 8 years ago

Weird issue happened today when I was quickly redeploying lambda functions to production.

Some of these functions didn't work. Error message was:

{
  "errorMessage": "callback called with Error argument, but there was \
  a problem while retrieving one or more of its message, name, and stack"
}

I redeployed these functions again with the same command, but one by one. In other words, 13 commands:

Problem solved. All functions are working properly.

One issue can be parallelism. Will test tomorrow with :parallel 1 if this is the issue. Also tried to Google it and found: https://github.com/lusentis/dawson/issues/1 It's worth to investigate it as well.

I've got environment where I can reproduce this issue (tried it, reproduced), will check what's wrong. Either permissions can be wrong in the ZIP file or there's issue when :parallel > 1.

moea commented 8 years ago

That's really weird - I haven't seen this.

What filesystem is this on? There was a change here a few months ago which looks correct, but which came to mind when I looked at that ticket you linked to.

I'm going to change over a client's CI deploy to use the multi-aliasing feature tomorrow, which'll turn it into a 15-function parallel deploy - will watch out for this.

zrzka commented 8 years ago

It's OS X (HFS+). Weird is that this doesn't happen in other projects where number of lambda functions > 1. Just this one. Seems like edge case of ... who knows, will try to find it today.

zrzka commented 8 years ago

Didn't find time today yet, will try tonight or on Saturday :(

zrzka commented 8 years ago

Back from vacation, investigation continues ...

moea commented 8 years ago

I just switched a client's CI over to use 0.6.1-SNAPSHOT, deploying 15 or so functions in single :publish :alias ... - the subset of fns I tested have worked through the 5 or so subsequent deploys - am watching out for errors.

zrzka commented 8 years ago

Case closed, issue was elsewhere, no bug in cljs-lambda plugin.

Details

ZIP file contains index.js file, which requires JS file with compiled lambda functions and lambda functions handlers exports. In case of cljs-lambda deploy FuncName there's just one export. In case of cljs-lambda deploy there are exports for all lambda functions. And this was the issue, because there was one lambda function (unused, no tests, kind of preparation for future) with wrong :export -> optimized out -> handler not found -> all lambda functions stopped working. This :export issue was hidden by deploy FuncName for every lambda function -> no export in index.js for this crippled lambda function (function wasn't used yet).

I can confirm that the problematic project was just fixed and it does work even with :parallel 15. I'm sorry for the buzz.

moea commented 8 years ago

No problem!