Decrease Cloud Code deployment size

Good Day,

I would like to move over to the scale plan.

However I see that my Cloud Code deployment size is 59MB which is over the 20MB allocated in the scale plan. Can you kindly assist me in showing me where this data is stored so I can delete unnecessary files.

Kind Regards

Hello @Donovan_Hardwick,

the deployment size includes all files you’re created along with dependency modules (node_modules) that you are using.
You can check the size of the deployment model using the following command when deploy:
npm run deploy -- --verbose --keep-zip --zip-size-confirmation

To reduce the deployment size, consider minimizing the installation of the dependencies to only the ones your code needs/uses. Additionally, you may apply additional filtering to identify what should be skipped from the dependent module’s folder. For instance, if {some_module} has the examples folder you may omit its inclusion by adding the following exclusion pattern in app.files of the coderunner.json file - !node_modules/some_module/examples.

More information:
The size of my code is bigger than allowed in the current payment tier

Regards,
Stanislaw

Hi Stanislaw

Thank you for your assistance, but unfortunately this all sounds like french to me. I have very little understanding of this.

I have however had a look in the Files section and Cloud code section of backendless and don’t see anything that comes close to 59MB, most files are 8KB in size.

Kind Regards

What’s your app id?

App ID: 56447795-182A-D679-FF9E-05029343F800

If you download your default JS model, unzip it and check the node_modules size, you’ll see that it consumes 40.6Mb:

As I said you can reduce the size of modules by revising your dependencies, potentially getting rid of unnecessary modules if there are any, and also omitting unnecessary files/directories when deploying for those modules that you need (for example, there is a module fooBar, which has a folder inside - “examples”. It takes up space and you don’t want them to end up in your deployment model. You can omit it by adding the following exclusion pattern in app.files of the coderunner.json file - !node_modules/fooBar/examples. This will instruct the coderunner to skip this directory when deploy.

Regards,
Stanislaw

Thank Stanislaw

Why can I not see this on my side?

You have the Java language selected in the toolbar. Change to JavaScript to see it’s files.

Thanks again. Ive had a quick look at everything and most files are between 50bytes to 2KB. But I honestly don’t know what I need and don’t need.

Any advise on what to look for?

The problem is with the jspdf module - it has a lot of redundant dependencies, unused files (such as docs and examples), and so on. You may find someone who knows the JS and can help you reduce the size of this module, possibly by using the jspdf.node.min.js file from their dist folder instead of using the npm module:

Or you may want to consider replacing this module with another (lighter) one.

Regards,
Stanislaw

Thank you for your assistance Stanislaw.

Do you know anyone I can speak to?

Kind Regards

Who did this service for your app? If you have contacts, you may ask them to help you.
Another option is to contact us at sales@backendless.com and we will find a solution for you.

Regards,
Stanislaw

Hi Stanislaw

I built the app but I started from the “CRM App Template” offered by backendless.

Kind Regards

I searched, and found this chat history. I wonder what do you changed to fix the issue. I had the same issue now.

Hello @Eva_Software

You can try the solution described in this post Decrease Cloud Code deployment size - #6 by stanislaw.grin.

Regards,
Inna

Hey @Eva_Software,

let me know if you need some assist, I will be happy to help you.

Regards,
Stanislaw

Yes. Thank you for offering help. I am trying to develop an app based on CRM template. But when I installed CRM template, it shows the deployment code size 40M. can you help me to point the directions how to clean the code, So it can reduce the deployment size. I only need a couple of pages from the template.

Thanks

Eva

Hi @Eva_Software

We have improved CloudCode for the blueprint but it’s still in the testing stage.
However, I can provide you with a new (NOT FULLY TESTED) CloudCode version and you will be able to try it in your app

Instructions:

  1. goto the Cloud Code => Codding => select JS
  2. download the deployment model to keep the backup
  3. download the attached zip file below and unzip it
  4. copy the coderunner.json file from your code (zip file from step 2) and paste it into the folder from step 3
  5. open the directory from step 3 in the terminal and run npm i
  6. then run npm run deploy
  7. finally, go back to the Codding screen (refresh the browser page if necessary)

CRM__JS_default_coding.zip (465.1 KB)

Regards,
Vlad

Hi, @Donovan_Hardwick and @Eva_Software !

We are happy to announce that the CRM app has been updated to the 2.1.0 version with a decreased CloudCode deployment size. You already can try it on the Marketplace.

Happy Codeless Coding!