You may come across the following error when deploying your html5 app (e.g. UI5) to Cloud Foundry:
Error: maximum file length exceeded
We use the
HTML5 Application Repository to serve static content for web applications like UI5 apps.
The error occurs because the default limit (in MB) for the content deployed to an
html5-apps-repo service instance (service plan
app-host) is 2.
The fix is documented in KB
2764058 which instructs us to set the
sizeLimit in the
mta.yaml (multi-target application archive) file to a higher value. Sadly, it isn't very specific about where in the file you should do it.
We configure the required services in the resources section and we put the size limit against the
repo-host service, like this:
resources:
- name: my-cf-ui_html5_repo_runtime
parameters:
service-plan: app-runtime
service: html5-apps-repo
type: org.cloudfoundry.managed-service
- name: my-cf-ui_html5_repo_host
parameters:
service-plan: app-host
service: html5-apps-repo
config:
sizeLimit: 8
type: org.cloudfoundry.managed-service
Here we set the limit to 8MB. Don't forget to check your indentation!
Note that alternatively you can set the parameter in the service instance directly:
cf update-service my-cf-ui_html5_repo_host -c '{ "sizeLimit": 8 }'
Bear in mind that setting size limit in the mta means that it will be set automatically in each environment as you deploy the mta, which is probably advantageous. I would only use
update-service if I was deploying using
cf push rather than
cf deploy.