I am writing my backend code in javascript and just the size of node_modules after installing “backendless-coderunner” is 27MB. I am trying to deploy my code and I get the error:
Custom business logic execution has been terminated because the size of code is bigger than allowed in the current payment tier
You can decrease an application deployment zip size by adding an exclusion filters to your {app.files} config parameter.
What is the app.files config parameter? Where does it go? What exactly can I exclude?
Thanks
-
app.files is a config parameter located in the {PROJECT_DIR}/coderunner.json
-
It contains an array of inclusion/exclusion patterns forming the content of the server code deployment
-
By default it contains a pattern which is described as ‘include all files under ‘{PROJECT_DIR}/app’ folder’.
-
Automatically, CodeRunner will include to the deployment all non-dev dependencies from the node_modules folder listed in project.json.
-
backendless-coderunner is a dev dependency and those will be skipped
-
You can run the deployment with few additional parameters which will give you more control on what’s going on
npm run deploy -- --verbose --keep-zip
With --verbose parameter, you will see all deployment patterns applied (declared in app.files param explicitly and automatically added)
With --keep-zip parameter, after deployment (or its attempt) you will find deploy.zip file in the {PROJECT_DIR} folder. You will be able to check its size and the content
7. Cumulative size of the deployed code (which includes all dependencies) is limited for the Backendless Online deployments to 2 megabytes. It can be expanded by purchasing a Function Pack from the Backendless Marketplace
8. To reduce the deployment size, consider minimizing the installation of the dependencies to only what the code needs
9. Additionally you may filter of what from the depended module folder should be skipped. For instance if {some_module} has examples folder you may omit its inclusion by adding the following exclusion pattern to app.files - ‘!node_modules/some_module/examples’
10. Some of this information can be found in the README file of the generated and downloaded from console servercode project. There are several examples of app.files config parameter tweaking
11. We will update the JS ServerCode documentation to have all this information included
Thanks
Thanks for the detailed reply. I have installed mailgun-js and that takes 9MB by itself. I have upgraded the deployment limit to 10MB and got to deploy successfully. You guys should provide another upgrade that allows us to push more code.
The limit is 2 mb script deployment limit on the free tier. Just for clarification does this mean 2mb at a time, or 2mb aggregate allowed in the cloud?
This means 2 mb per service or per handler.
Hm? In the js case isn’t it the size of deploy.zip?
Oh yes, you’re right, I apologize.
In general, each single archive (.zip, .jar etc.) should be less than the limit.