serverless-babel-plugin
serverless-babel-plugin copied to clipboard
Not working when a function handler is in a subdirectory
I have a Lambda function which the handler is in a subdirectory, e.g.:
functions:
myFunction:
handler: myFunction/handler.myFunction
When I deploy with the plugin enabled, the handler is not included in the generated archive, thus my deployed function does not work.
I am using this plugin with Serverless 1.2.0.
@plbrault thx for reporting. That's indeed a bug. I hope I get to fix it tomorrow or Monday.
Curious if there has been any progress towards this bug. This package would be amazing for my use case if you can use handlers within subdirectories.
Thanks for your work!
Has there been any progress on this?
I'm not working actively on it. Would you be interested taking ownership in this project?
@nikgraf Do you know where i could start looking to fix this bug.
@nikgraf @peisenhower any progress on this?
Any workarounds for this for the moment?
Still doesn't work in 2018.
I have this issue. My functions are written in typescript and compiled to a folder called 'out'. They are then packaged up as so:
functions:
myfunction:
handler: out/myfunction.handler
package:
include:
- out/myfunction.js
After running serverless package
I can see the generated zip file contains the correct folder and file. After running serverless deploy
, the lambda function created in AWS is empty.
I should also say, this has nothing to do with the babel plugin as I'm not using that.
I was running into a similar problem, what helped me get around it was building my own .zip artifact with everything in the root and specifying that in the serverless.yml using the package.artifact key.
@johneast your serverless.yml looks odd, btw; package is a top-level directive, not a sub node of functions.<funcname>:
functions:
myfunction:
handler: out/myfunction.handler
package:
include:
- out/myfunction.js
Anyway, package.include didn't work for me (it would include the entire dir), so I ended up going with package.artifact, instead.
Multi function independently packaged approach does not seem to work at all.
Handler function not present; unzip_requirement.py hidden in a complex directory structure; other irrelevant directories included in the zip.
Generally not up to it for a real use case. Shame
Would also be interested in seeing this exist
Yes !
On 18 Jul 2018, at 15:59, Max Kraan [email protected] wrote:
Would also be interested in seeing this exist
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/serverless/serverless-babel-plugin/issues/3#issuecomment-405961895, or mute the thread https://github.com/notifications/unsubscribe-auth/AT6OHRH35gUj2YZcICNbUmzfypCj67h6ks5uH002gaJpZM4K5zPd.
This is interesting feature. I think this is might be useful for me who use Typescript, cases like @johneast. Yes, serverless-plugin-typescript
is exist for Typescript project but that would be great if this alternative method to refer subfolder handler exist.
I'm still facing the same issue. It seams that it is considered a very low priority bug
I've been able to resolve this problem by placing a './' in front of the directory name.
Example Project Structure:
- Project_Dir
- lambda_functions
- sample_lambda
- app.py
- sample_lambda
- template.yaml
- lambda_functions
Example Yaml:
Resources:
SampleLambda:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./lambda_functions/sample_lambda/
Handler: app.lambda_handler
Runtime: python3.8
@plbrault thx for reporting. That's indeed a bug. I hope I get to fix it tomorrow or Monday.
I'm not working actively on it. Would you be interested taking ownership in this project?
paint me a clown