-
Notifications
You must be signed in to change notification settings - Fork 417
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
Single function deploy does not invoke the plugin #107
Comments
I analyzed the issue and found the root cause (also copied in the references serverless issue): The webpack plugin is invoked on the 'before:deploy:createDeploymentArtifacts' and 'after:deploy:createDeploymentArtifacts' hooks, which are not exposed by the AWS function deploy core plugin (there only 'deploy:function:packageFunction' is available). That's why the webpack packing is not invoked at all in this case. The correct solution would be to hook 'before:deploy:function:packageFunction' and package the requested function chunk. |
I guess the difficulty here is determining which webpack entry points map to which services in the serverless config. Hooking into the correct events is a lot easier. |
Any more progress on #110 ? |
Did not have time to investigate the problem with my PR further. Currently I am implementing parts of the new package/deploy mechanism in Serverless and try to keep it compatible with the existing plugins. |
Appreciate the update! |
Shifted to 2.1.0 as there are still discussions on how to improve the implementation provided in #130 . |
PR #130 is merged. |
Hi, I'm running webpack 2.7.0 and serverless 1.19.0 and the problem still persist.
Gives me the following error when deploying:
Is anything that I'm missing or wrongly configuring? |
@nicolasdonoso Which serverless-webpack plugin version did you use? The support for package individually is currently implemented and available in the Can you give that branch a try and check if it solves the problem for you? |
@HyperBrain thanks for the response, I added the branch that you are telling me and deployed the hole project and I get the following error:
This happens when adding:
After that I tried to deploy a single function and it states "Serverless: Bundling with Webpack..." what wasn't happening on previous versions, but after that I get the following error:
|
@nicolasdonoso Thanks for testing 👍 . Can you check that you have
at the top-level of your serverless.yml? And verify that the Additionally it would be great to see your webpack.conf.js to check if the configuration there is correct. There's now the possibility to enable automatic entry/handler resolution in the webpack config. I'm quite sure it's only some configuration issue. |
@HyperBrain Yes I have that on top-level of my serverless.yml. The handler definitions are pointing correctly and its generating the .webpack folder with all the functions inside as individual folders. Now its logging me the following error:
My webpack.config.js is the following:
|
Can you try to use |
We just tried what you told us, and it works. But we are getting this response from our function once its deployed: |
Can you open/extract the zip file the deployment created in
|
I double checked our serverless.yml and the definition was affecting the deployment. |
😃 You're welcome |
The whole project deploys correctly, but when deploying individual functions I'm getting the following error:
|
Thanks for the info. I think you just found a small bug of the single function deploy together with the individual packaging. |
Ok, just created a new issue #181 |
I do not know if this is a problem with Serverless' lifecycle events or if it is a problem within the webpack plugin. If I try to upload a single function during development, using
serverless deploy function -f auth
the webpack build is not triggered and Serverless tries to upload the whole project which exceeds the upload file size limit of 70MB.When deploying the complete service with
serverless deploy
the plugin is invoked correctly and the resulting function code ZIP is about 17MB.If it turns out that the problem is on Serverless' side, we should create an issue there.
The text was updated successfully, but these errors were encountered: