node.jssapui5sap-fiorisap-business-technology-platformsap-cap

Error while deploying SAP Fiori and CAPM application in SAP BTP Trial Account


I created a basic SAP CAP/Fiori application using BAS of SAP BTP, with HANA DB Instance created. It's working fine when I run it locally. However, during deployment to SAP BTP Trial Account, I encountered the issue/error below.

After deployment was completed with errors, the SAP CAP Service is working fine, only the SAP Fiori which is not working since an error was encountered during deployment.

Error encountered during deployment

Error starting application "Bookshop2": Some instances have crashed. Check the logs of your application for more information.
Download the application logs via the dmol command and check them for more information.
A step of the process has failed. Retrying it may solve the issue.
Proceeding with automatic retry... (3 of 3 attempts left)

Content of dmol(Logs)

Inside dmol, an error Cannot open: No space left on device was encountered.

######org.cloudfoundry.multiapps.controller.persistence.services.ProcessLogger########flowable-async-job-executor-thread-8326###
[PollStageAppStatusExecution] [Bookshop2] 238506b3-8a7f-415f-bcab-7c8de217ee09 [2023-04-19T16:44:37.035921] Copying droplet into the container failed: stream-in: nstar: error streaming in: exit status 2. Output: tar: ./app/bookshop/node_modules/@sap/di.code-validation.xml/src/fioriAnalysis/ui5Versions/1.60.13/_sap.m.json: Wrote only 512 of 10240 bytes (STDERR, CELL)#

#2.0#2023 04 19 17:15:28.108#Z#DEBUG#com.sap.cloud.lm.sl.xs2.783edf34-ded5-11ed-8416-eeee0a9a8355.Bookshop2.stageAppTask#
######org.cloudfoundry.multiapps.controller.persistence.services.ProcessLogger########flowable-async-job-executor-thread-8326###
[PollStageAppStatusExecution] [Bookshop2] 238506b3-8a7f-415f-bcab-7c8de217ee09 [2023-04-19T16:44:37.035939] tar: ./app/bookshop/node_modules/@sap/di.code-validation.xml/src/fioriAnalysis/ui5Versions/1.60.13/_sap.ui.commons.json: Cannot open: No space left on device (STDERR, CELL)#

Steps for deployment

Cds add hana –for production
Cds add xsuaa –for production
Cds add mta (Optional in case you don’t have it yet.)
Cds add approuter –for production
It will generate xs-app and default-env.json inside /app folder. 
Npm install

Cds build –production
Mbt build -t gen –mtar mta.tar

cf login
cf deploy gen/mta.tar

Code Snippet

A code snippet use for creating a basic Fiori/CAP application.


mta.yaml

ID: Bookshop2
description: A simple CAP project.
version: 1.0.0
modules:
  - name: Bookshop2-srv
    type: nodejs
    path: gen/srv
    provides:
      - name: srv-api
        properties:
          srv-url: ${default-url}
    parameters:
      buildpack: nodejs_buildpack
    build-parameters:
      builder: npm-ci
    requires:
      - name: Bookshop2-db
      - name: Bookshop2-auth
  - name: Bookshop2-app-content
    type: com.sap.application.content
    path: .
    requires:
      - name: Bookshop2-repo-host
        parameters:
          content-target: true
    build-parameters:
      build-result: resources
      requires:
        - artifacts:
            - combookshopfioribookshop.zip
          name: combookshopfioribookshop
          target-path: resources/
  - name: combookshopfioribookshop
    type: html5
    path: app/bookshop
    build-parameters:
      build-result: dist
      builder: custom
      commands:
        - npm install
        - npm run build:cf
      supported-platforms:
        []

  - name: Bookshop2-db-deployer
    type: hdb
    path: gen/db
    parameters:
      buildpack: nodejs_buildpack
    requires:
      - name: Bookshop2-db

  - name: Bookshop2
    type: approuter.nodejs
    path: app/ # from cds.env.folders. Consider also cds.env.build.target -> gen/app
    parameters:
      keep-existing-routes: true
      disk-quota: 256M
      memory: 256M
    requires:
      - name: srv-api
        group: destinations
        properties:
          name: srv-api # must be used in xs-app.json as well
          url: ~{srv-url}
          forwardAuthToken: true
      - name: Bookshop2-auth
resources:
  - name: Bookshop2-repo-host
    type: org.cloudfoundry.managed-service
    parameters:
      service: html5-apps-repo
      service-name: Bookshop2-html5-srv
      service-plan: app-host
  - name: Bookshop2-destination-service
    type: org.cloudfoundry.managed-service
    parameters:
      config:
        HTML5Runtime_enabled: false
        init_data:
          instance:
            destinations:
              - Authentication: NoAuthentication
                Name: ui5
                ProxyType: Internet
                Type: HTTP
                URL: https://ui5.sap.com
            existing_destinations_policy: update
        version: 1.0.0
      service: destination
      service-name: Bookshop2-destination-service
      service-plan: lite
  - name: Bookshop2-db
    type: com.sap.xs.hdi-container
    parameters:
      service: hana
      service-plan: hdi-shared
  - name: Bookshop2-auth
    type: org.cloudfoundry.managed-service
    parameters:
      service: xsuaa
      service-plan: application
      path: ./xs-security.json
      config:
        xsappname: Bookshop2-${org}-${space}
        tenant-mode: dedicated
parameters:
  deploy_mode: html5-repo
  enable-parallel-deployments: true
build-parameters:
  before-all:
    - builder: custom
      commands:
        - npx -p @sap/cds-dk cds build --production

package.json

  "name": "Bookshop2",
  "version": "1.0.0",
  "description": "A simple CAP project.",
  "repository": "<Add your repository here>",
  "license": "UNLICENSED",
  "private": true,
  "dependencies": {
    "@sap/cds": "^6",
    "express": "^4",
    "hdb": "^0.19.0",
    "@sap/xssec": "^3",
    "passport": "^0"
  },
  "devDependencies": {
    "@sap/ux-specification": "^1.108.3",
    "sqlite3": "^5",
    "rimraf": "^3.0.2"
  },
  "engines": {
    "node": "^16"
  },
  "scripts": {
    "start": "cds-serve",
    "watch-bookshop": "cds watch --open bookshop/webapp/index.html?sap-ui-xx-viewCache=false",
    "undeploy": "cf undeploy Bookshop2 --delete-services --delete-service-keys --delete-service-brokers",
    "build": "rimraf resources mta_archives && mbt build --mtar archive",
    "deploy": "cf deploy mta_archives/archive.mtar --retries 1"
  },
  "sapux": [
    "app/bookshop"
  ],
  "cds": {
    "requires": {
      "[production]": {
        "db": {
          "kind": "hana-cloud"
        },
        "auth": {
          "kind": "xsuaa"
        },
        "approuter": {
          "kind": "cloudfoundry"
        }
      },
      "db": {
        "kind": "sql"
      }
    }
  }
}

db/domain-model.cds

namespace com.bookshop2;

entity Books {
    key ID  : Integer;
    title   : String(100);
    stock   : Integer;
    price   : Decimal(9,2);
    author  : Association to Authors;
}

entity Authors {
    key ID  : Integer;
    name    : String(100);
    books   : Composition of many Books on books.author = $self;
}

srv/service.cds

using { com.bookshop2 as bookshop } from '../db/domain-model';

service AdminService {
    entity Books as projection on bookshop.Books;
    entity Authors as projection on bookshop.Authors;
}

SAP UI5 / Fiori App

Basic Freestyle or Any Fiori Element Template.

SAUI5 ui5.yaml

metadata:
  name: com.bookshop.fiori.bookshop
type: application

SAPUI5 ui5-deploy.yaml

specVersion: '2.4'
metadata:
  name: com.bookshop.fiori.bookshop
type: application
resources:
  configuration:
    propertiesFileSourceEncoding: UTF-8
builder:
  resources:
    excludes:
      - "/test/**"
      - "/localService/**"
  customTasks:
  - name: webide-extension-task-updateManifestJson
    afterTask: replaceVersion
    configuration:
      appFolder: webapp
      destDir: dist
  - name: ui5-task-zipper
    afterTask: generateCachebusterInfo
    configuration:
      archiveName: combookshopfioribookshop
      additionalFiles:
      - xs-app.json

Update: Solution to the Deployment Issue.

You need to change the disk-quota and memory of your Fiori/SAUI5 app from 256M to at least 1024MB. enter image description here


Solution

  • I have managed to solve the deployment issue with the help of SAP Experts by changing the disk-quota and memory of SAPUI5/Fiori App of mta.yaml file from 256M to 1024MB.

    enter image description here