-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respect individually option #5
Comments
index.jsWith this example serverless.yml: functions:
abc:
cljs: example.core/abc cljs-lambda'll generate an index.js with a function called abc (from this template, or one like it, depending on the optimisation level - see the parent directory), which loads the relevant namespaces and invokes example.core/abc. Knowing this, the serverless plugin updates the functions:
abc:
handler: index.abc This is because for a variety of reasons it's not practical to instruct the Lambda runtime to load a module of JS that's been directly compiled from cljs, so we have index.js to intermediate. individually: trueI'm not averse to supporting this, but I'm not sure the effort is worth the reward. What would you hope to get out of it? |
individually: trueI observed what
So this might easy to do then, the only concern is when you have both |
The name handler.js or index.js is arbitrary, it just has to correspond to the prefix of the handler values passed to aws, so it knows which module to load. With cljs-lambda, the contract is that the module is always called index.js. While in your example it creates two identical zip files, there are almost certainly per-function options you can set (e.g. include/exclude) in your serverless.yml which would affect the contents of zip files, otherwise the feature would be completely useless. I'm still not sure I understand the utility of making the change in the context of this plugin. |
No sorry I have not explained my concern properly. At the moment I have:
So I have a |
Sorry the discussion has derailed a bit, so I guess my question is whether I need to change something in order to have a mixed JS + cljs setup. |
I see, apologies for the misunderstanding. In theory bunyan-lambda-cljs will invoke the handler in index.js, and the other guys will invoke the handlers in handler.js, which is what you want. Something else may well break though, I haven't tried this. And it may work for simple setups, but break if you wanted to do some preprocessing on the js code, using babel, or whatever - I would personally have two different projects / serverless.yml files. |
I was also wondering another thing about the famous |
How much more dynamic could the generation be? cljs-lambda avoids running any user code, it just invokes the compiler and builds a zip file. The inputs to the template are obtained by parsing serverless.yml. The thing about appending to handler.js is a red herring - whatever problems may exist with having js and cljs live side-by-side in a single serverless.yml, they don't have anything to do with index.js vs handler.js. There is no requirement in serverless or lambda that there's a file called handler.js - you created a file called handler.js, possibly because you were working from an example which used handler.js. You could rename it to anything you wanted, as long as the If you want this to work, please create a public github repository with a serverless.yml and some js + cljs functions, which doesn't do what you expect when you invoke them after deploying, and I will try to help you with it. |
I guess you are right I am overengineering.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
Hi there again,
opening this PR because I have two issues. One is major and a feature request. I have:
JS code is zipped correctly so I have two lambdas. However the
serverless-cljs-plugin
just packages everything in a zip.I saw the implementation and it is no handling it. That's ok, is there anything I need to know if I want to tackle this problem?
For instance, there is an
index.js
there, which is generated. What was the purpose of it?Thanks a lot for your patience 😄
PS.: I was able to create a zip with the
lumo
compiler but I am still finishing it off.The text was updated successfully, but these errors were encountered: