Free plan business logic limits unclear

Hi,

I don’t really understand. Since you guys changed free plan limits, I’m trying to update my project to work on a free plan, but it seems it is still hitting the limits. In the below screenshot you can see I am using only 1 event handler and no timers, and it fails. I am also using two ‘services’ scripts, but from the description, it doesn’t mention ‘services’ to be included in the limits.

Screenshot 2024-04-03 at 20.01.57

So what should be changed to conform to the free plan limits here?

Tried uploading for the App ID: F2FE78BB-5D08-44FE-B074-6E7C29B49B03
but I will also need this for 3814A184-21FB-4269-A3B8-C656C0C4BC36 too

Thanks.

The free plan includes up to two Cloud Code “scripts”; these include event handlers and timers. API Services are not counted towards the limit.

This app F2FE78BB-5D08-44FE-B074-6E7C29B49B03 has two event handlers. One is in the Draft mode and the other is in the Prod mode.

This app 3814A184-21FB-4269-A3B8-C656C0C4BC36 has only one event handler.

Regards,
Mark

Hi Mark,

Thanks for the clarification. While I was under the assumption that the number of scripts is the issue, it’s actually the “Business Logic deployment size”.

I checked it and tried to get it under the limits of the free plan, but doing a simple npm run deploy -- --verbose --keep-zip command, it says the event handlers and service scripts already exists. I used to do this, and it used to simply override the files to the newest. Should I approach this somehow different this time?

Also, are you guys counting the size, or size on disk? Apparently, I am back on the same error now after trying a few times with the following deploy size (unpacked deploy.zip)

Hi @Justinas_Grazulis

According to the following errors:

  • event handler already exists …
  • services already exist

it happens when in the code you are trying to deploy there are duplicates of handlers/services.
perhaps you unzip the zip file into the root directory of the project
so make sure you have no duplicates

Regards,
Vlad

Hi @Justinas_Grazulis

We count the “size on disk,” which means that each file, regardless of its actual size, occupies a minimum of 4096 bytes due to our system’s allocation unit. If a file is smaller than 4096 bytes, it will still be counted as occupying 4096 bytes. This approach ensures that we are consistent with how disk storage space is managed in blocks.

Regards,
Viktor

Thanks Vladimir,

It looks like I left the ‘deploy’ directory undeleted after the unzipping deployment zip, and it showed the “already exists” message. Thanks!

Are you able to comment on the deployment size, how it’s calculated? I don’t really have anywhere to go after 603 KB, and it still shows the same message about exceeding deployment size.

Thanks,
Justinas

1 Like

Oh, just saw this message. Thanks for confirming.

Wow, it all in tandem makes it so annoying to make it work. I am just using two additional libs (Stripe and config). I removed any excess node_modules, even the nested dependencies used by Stripe’s lib and it still is above the limit. I HOPE I can fit to limits by removing the “config” lib, but coming from using it on free plan previously, it is really annoying to need to do this…

try to exclude all unnecessary files from the build

https://backendless.com/docs/bl-js/bl_troubleshooting.html#the-size-of-my-code-is-bigger-than-allowed-in-the-current-payment-tier

1 Like

Hi @vladimir-upirov ,

Thanks for the suggestion. I’m already following info from this link, but this time I tried removing the config library for further size reduction. Deployment should be now for sure under 1MB, but still says it’s above the limit. I am even stripping down the nested dependencies that are similar for pre-installed libraries to save size.

Could you advise?

App id is: F2FE78BB-5D08-44FE-B074-6E7C29B49B03

Thanks,
Justinas

could you please send us the project we will try to deploy it from our side

Hi @vladimir-upirov , just sent it you privately

Hi @Justinas_Grazulis

It seems like the zip file contains the built project, could you please exactly the project which contains the coderunner.json files and all files are going to be deployed

Hi @vladimir-upirov , just sent you, thanks for correcting which files you need!

Hi @Justinas_Grazulis

Thanks, I run npm i and then the deploy operation fails with the following error:

14:13:40.294 [master] Publishing Model to server
14:13:40.349 [master] Error: Error: Unable to publish model. Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'

it’s because there is an old version of the JS-CodeRunner (^6.1.1), I upgraded it to ^7.4.7

and finally I get the same error you have

Generated Zip File size is: 278.18 KB
Would you like to deploy it? (Y/N)y
15:08:15.639 [master] Publishing Model to server
15:08:17.009 [master] Error: Error: Unable to publish model. The application has been blocked due to the following reasons: 
Your application has exceeded a limit of the "Business Logic deployment size" on the current plan. All API calls are now blocked until the limits are increased.

It looks like it rejects the deploy request because the app is blocked, perhaps we can temporary remove the block to allow the publish

after removing the block I still can not deploy the server code:

15:13:26.619 [master] :: [Server 15:13:26.063] [error] Error during code inspection: {0={message=Cannot find module 'qs'
Require stack:
- /opt/backendless/repo/f2fe78bb-5d08-44fe-b074-6e7c29b49b03/files/servercode/JS/default/tmp1713960805148/node_modules/stripe/lib/utils.js
- /opt/backendless/repo/f2fe78bb-5d08-44fe-b074-6e7c29b49b03/files/servercode/JS/default/tmp1713960805148/node_modules/stripe/lib/StripeResource.js
- /opt/backendless/repo/f2fe78bb-5d08-44fe-b074-6e7c29b49b03/files/servercode/JS/default/tmp1713960805148/node_modules/stripe/lib/resources/Accounts.js
- /opt/backendless/repo/f2fe78bb-5d08-44fe-b074-6e7c29b49b03/files/servercode/JS/default/tmp1713960805148/node_modules/stripe/lib/resources.js
- /opt/backendless/repo/f2fe78bb-5d08-44fe-b074-6e7c29b49b03/files/servercode/JS/default/tmp1713960805148/node_modules/stripe/lib/stripe.js
- /opt/backendless/repo/f2fe78bb-5d08-44fe-b074-6e7c29b49b03/files/servercode/JS/default/tmp1713960805148/handlers/user/afterUpdate.js
- /usr/local/lib/node_modules/backendless-coderunner/lib/server-code/api/index.js
- /usr/local/lib/node_modules/backendless-coderunner/lib/server-code/runners/cloud-worker.js, position=null, serverCodeFile=/opt/backendless/repo/f2fe78bb-5d08-44fe-b074-6e7c29b49b03/files/servercode/JS/default/tmp1713960805148/handlers/user/afterUpdate.js, erredFile=handlers/user/afterUpdate.js}, 1={message=Cannot find module 'qs'
Require stack:
- /opt/backendless/repo/f2fe78bb-5d08-44fe-b074-6e7c29b49b03/files/servercode/JS/default/tmp1713960805148/node_modules/stripe/lib/utils.js
- /opt/backendless/repo/f2fe78bb-5d08-44fe-b074-6e7c29b49b03/files/servercode/JS/default/tmp1713960805148/node_modules/stripe/lib/StripeResource.js
- /opt/backendless/repo/f2fe78bb-5d08-44fe-b074-6e7c29b49b03/files/servercode/JS/default/tmp1713960805148/node_modules/stripe/lib/resources/Accounts.js
- /opt/backendless/repo/f2fe78bb-5d08-44fe-b074-6e7c29b49b03/files/servercode/JS/default/tmp1713960805148/node_modules/stripe/lib/resources.js
- /opt/backendless/repo/f2fe78bb-5d08-44fe-b074-6e7c29b49b03/files/servercode/JS/default/tmp1713960805148/node_modules/stripe/lib/stripe.js
- /opt/backendless/repo/f2fe78bb-5d08-44fe-b074-6e7c29b49b03/files/servercode/JS/default/tmp1713960805148/services/Stripe.js
- /usr/local/lib/node_modules/backendless-coderunner/lib/server-code/api/index.js
- /usr/local/lib/node_modules/backendless-coderunner/lib/server-code/runners/cloud-worker.js, position=null, serverCodeFile=/opt/backendless/repo/f2fe78bb-5d08-44fe-b074-6e7c29b49b03/files/servercode/JS/default/tmp1713960805148/services/Stripe.js, erredFile=services/Stripe.js}}
15:13:26.620 [master] :: [Server 15:13:26.070] [info] Deploy finished.
15:13:26.621 [master] Error: Error: Unable to publish model. This has been finished with an error, see the log messages above

it sounds like the issue with missing npm package

Hi @vladimir-upirov ,

Thanks for looking into this.

The ‘qs’ module is a requirement for stripe. I excluded qs since it is the same dependency as preinstalled aws-sdk lib has (aws-sdk → node-url → qs in aws-sdk - npm), and I hoped it would save me space. So maybe it was a bit over the top, and NPM doesn’t work well in such way. However, if I keep stripe with all dependencies, size on disk is over 1MB, even though folder size is only ~600KB (see image above in the thread). Seems there is no other way to keep the Stripe in, and that is a must for us.


Taking a top-down approach, I currently have 3 projects in my account. for Dev, Staging and Prod FaceGenius projects. I don’t need this much. We’re sunsetting our service, so we want to move Prod to a free plan on Backendless and we could delete all others.

To do that, I want to test updates on the dev or staging project so that the changes conforms to the free Backendless plan, and then apply it to prod to do it safely. I’m happy to delete dev and staging afterwards.


I will try to fix the ‘qs’ issue and update coderunner on my end to see once more if I can get it all within the limits and deploy successfully. What would be your suggestion on how to approach this in our case?

Thanks,
Justinas

I can recommend you avoid excluding all js files, instead try to exclude only some dev/tests/samples/etc files

https://backendless.com/docs/bl-js/bl_troubleshooting.html#the-size-of-my-code-is-bigger-than-allowed-in-the-current-payment-tier

Hi @vladimir-upirov ,

I got a deployment size under 900KB for size on disk, still getting the same message.

Can you advise? I’m sending the latest archive with project in private message.

This is what the app shows for what’s already deployed: