cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CAP application not working with HANA Cloud DB after deployment

EkanshCapgemini
Active Contributor
0 Kudos
562

Hi,

I have a very simple CAP project in BAS with HANA Cloud DB and Fiori Elements with OData v4 (without any service implementation or extensions). I deployed this project on client's BTP subaccount CF space without any errors, but when I click on Create button in Fiori Elements UI, I receive 500 error and the OData service log shows below error:

argument type mismatch: not supported path expression: must be json list for array index access\n-> $[\"DraftUUID\"]\n-> ^\n 

In my understanding, CAP service is not able to create a Draft row in HANA DB when UI sends a POST call with empty object as payload (standard fiori elements stuff).

However, when I downloaded the codebase from client's BAS, imported in my trial account and deployed, it works as it should. The draft gets created successfully in trial account and I see the Object page in create mode. I compared the tables and views created in the HDI container and those are exactly the same.

On client's stack, I have undeployed and deployed this app several times and nothing works. 

 

Can you please help in fixing this issue?

Here is the package.json file:

{
  "name": "papm-poc2",
  "version": "1.0.0",
  "description": "A simple CAP project.",
  "repository": "<Add your repository here>",
  "license": "UNLICENSED",
  "private": true,
  "dependencies": {
    "@sap/cds": "^8.7.2",
    "express": "^4",
    "@sap/xssec": "^4.4.0",
    "@cap-js/hana": "^1.6.1"
  },
  "devDependencies": {
    "@cap-js/cds-types": "^0.9.0",
    "@cap-js/sqlite": "^1",
    "@sap/cds-dk": "^8.7.2",
    "rimraf": "^5.0.5",
    "mbt": "^1.2.29"
  },
  "scripts": {
    "start": "cds-serve",
    "watch-papmpoc2costpool": "cds watch --open papmpoc2costpool/webapp/index.html?sap-ui-xx-viewCache=false",
    "undeploy": "cf undeploy papm-poc2 --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"
  },
  "cds": {
    "requires": {
      "connectivity": true,
      "destinations": true,
      "html5-runtime": true,
      "[production]": {
        "db": "hana",
        "auth": "xsuaa"
      }
    },
    "sql": {
      "native_hana_associations": false
    }
  },
  "sapux": [
    "app/papmpoc2costpool"
  ]
}

Here is the mta.yaml file:

_schema-version: 3.3.0
ID: papm-poc2
description: A simple CAP project.
version: 1.0.0
modules:
  - name: papm-poc2-srv
    type: nodejs
    path: gen/srv
    requires:
      - name: papm-poc2-db
      - name: papm-poc2-connectivity
      - name: papm-poc2-destination
      - name: papm-poc2-auth
    provides:
      - name: srv-api
        properties:
          srv-url: ${default-url}
    parameters:
      buildpack: nodejs_buildpack
      instances: 1
    build-parameters:
      builder: npm-ci
  - name: papm-poc2-db-deployer
    type: hdb
    path: gen/db
    requires:
      - name: papm-poc2-db
    parameters:
      buildpack: nodejs_buildpack
  - name: papm-poc2-destinations-deployer
    type: com.sap.application.content
    requires:
      - name: srv-api
      - name: papm-poc2-srv
      - name: papm-poc2-destination
        parameters:
          content-target: true
      - name: papm-poc2-html5-repo-host
        parameters:
          service-key:
            name: papm-poc2-repo-host-key
      - name: papm-poc2-auth
        parameters:
          service-key:
            name: papm-poc2-auth-key
    parameters:
      content:
        instance:
          destinations:
            # - Authentication: OAuth2UserTokenExchange
            #   HTML5.Timeout: 180000
            #   Name: papm-poc2-srv
            #   TokenServiceInstanceName: papm-poc2-auth
            #   TokenServiceKeyName: papm-poc2-auth-key
            #   URL: ~{srv-api/srv-url}
            - Name: papm-poc2-repo-host
              ServiceInstanceName: papm-poc2-html5-service
              ServiceKeyName: papm-poc2-repo-host-key
              sap.cloud.service: com.client.ra.poc2
            - Authentication: OAuth2UserTokenExchange
              Name: papm-poc2-auth
              ServiceInstanceName: papm-poc2-auth
              ServiceKeyName: papm-poc2-auth-key
              sap.cloud.service: com.client.ra.poc2
          existing_destinations_policy: update
    build-parameters:
      no-source: true
  - name: papm-poc2-app-deployer
    type: com.sap.application.content
    path: .
    requires:
      - name: papm-poc2-html5-repo-host
        parameters:
          content-target: true
    build-parameters:
      build-result: resources
      requires:
        - artifacts:
            - comclientrapapmpoc2costpool.zip
          name: comclientrapapmpoc2costpool
          target-path: resources/
  - name: comclientrapapmpoc2costpool
    type: html5
    path: app/papmpoc2costpool
    build-parameters:
      build-result: dist
      builder: custom
      commands:
        - npm install
        - npm run build:cf
      supported-platforms: []
resources:
  - name: papm-poc2-auth
    type: org.cloudfoundry.managed-service
    parameters:
      config:
        tenant-mode: dedicated
        xsappname: papm-poc2-${org}-${space}
      path: ./xs-security.json
      service: xsuaa
      service-plan: application
  - name: papm-poc2-db
    type: com.sap.xs.hdi-container
    parameters:
      service: hana
      service-plan: hdi-shared
  - name: papm-poc2-connectivity
    type: org.cloudfoundry.managed-service
    parameters:
      service: connectivity
      service-plan: lite
  - name: papm-poc2-destination
    type: org.cloudfoundry.managed-service
    parameters:
      config:
        HTML5Runtime_enabled: true
        init_data:
          instance:
            destinations:
              - Authentication: NoAuthentication
                HTML5.DynamicDestination: true
                HTML5.ForwardAuthToken: true
                Name: papm-poc2-srv-api
                ProxyType: Internet
                Type: HTTP
                URL: ~{srv-api/srv-url}
              - Authentication: NoAuthentication
                Name: ui5
                ProxyType: Internet
                Type: HTTP
                URL: https://ui5.sap.com
            existing_destinations_policy: update
      service: destination
      service-plan: lite
    requires:
      - name: srv-api
  - name: papm-poc2-html5-repo-host
    type: org.cloudfoundry.managed-service
    parameters:
      service: html5-apps-repo
      service-name: papm-poc2-html5-service
      service-plan: app-host
parameters:
  deploy_mode: html5-repo
  enable-parallel-deployments: true
build-parameters:
  before-all:
    - builder: custom
      commands:
        - npm ci
        - npx cds build --production

Br, Ekansh

SAP HANA Cloud SAP Cloud Application Programming Model SAP Fiori Elements 

View Entire Topic
Willem_Pardaens
Product and Topic Expert
Product and Topic Expert
0 Kudos

If the application works in one environment but not the other, there is probably nothing wrong with the app, but with the environment in which it runs.

You can check the HANA Cloud instance to see if it is up-to-date. Newer versions of the @cap-js/hana package might require a newer version of the HANA Cloud database as well.

SSaiSanthosh
Discoverer
0 Kudos
in the same environment itself its not working., i tried in local bas run and deploy one also not working. but select query i working perfect. @cap-js/hana i am using later version only.
EkanshCapgemini
Active Contributor
0 Kudos
The HANA Cloud instance was already on the latest version available (2025.2.12). However, the solution for now is to downgrade the @cap-js/hana package to 1.8.1.