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

HANA Cloud database connection not present in run configuration dependencies

sirpancreasjr
Newcomer
0 Likes
558

Hello all,

I'm developing a full-stack CAP application that includes three main components: a Fiori list page for front end, and a SAP HANA Cloud database for data storage, and a CAP app to tie the two together.

I have successfully bound and deployed to the database connection, as evidenced by the schema's produced and my ability to import data via the database explorer. My understanding is that the action of binding includes the database as a "dependency" to the project.

Screenshot 2024-07-24 143421.png
Screenshot 2024-07-24 141802.png

My issue is that I cannot seem to expose database data to the Fiori list page. I haven't started developing the list page yet, but this data should at the very least be listed in the raw OData output when I run the application. The connected database is not showing up as a dependency under run configurations, and I do not have the option to make a "production" configuration to see if it's any different.

Screenshot 2024-07-24 143722.pngScreenshot 2024-07-24 143738.png

Unsurprisingly, running this configuration uses the in-memory database feature, and doesn't expose the HANA Cloud data I've set up.

Could someone tell me where my issue could be? I've tried researching this question, but everyone seems to assume that if you set up your database connection properly, it should be available in run configurations. No one seems to be able to do the first but not the second.

Lastly, I'll include two files from the project I've been messing with the most. I assume the problem is somewhere in "[project root]/package.json" or "[project root]/mta.yaml", but again I can't be sure.

package.json:

{
  "name": "BWZ_User_Statistics",
  "version": "1.0.0",
  "description": "A simple CAP project.",
  "repository": "<Add your repository here>",
  "license": "UNLICENSED",
  "private": true,
  "dependencies": {
    "@cap-js/hana": "^1",
    "@sap/cds": "^8",
    "@sap/xssec": "^4",
    "express": "^4"
  },
  "devDependencies": {
    "@cap-js/cds-types": "^0.6",
    "@cap-js/sqlite": "^1",
    "@sap/cds-dk": ">=7"
  },
  "scripts": {
    "start": "cds-serve"
  },
  "cds": {
    "build": {
      "target": "gen",
      "tasks": [
        {
          "for": "hana",
          "src": "db",
          "options": {
            "model": [
              "db",
              "srv",
              "app"
            ]
          }
        },
        {
          "for": "nodejs",
          "src": "srv",
          "options": {
            "model": [
              "db",
              "srv",
              "app"
            ]
          }
        }
      ]
    },
    "requires": {
      "[production]": {
        "db": "hana",
        "auth": "xsuaa"
      }
    }
  }
}

mta.yaml:

_schema-version: 3.3.0
ID: BWZ_User_Statistics
description: A simple CAP project.
version: 1.0.0
modules:
  - name: BWZ_User_Statistics-srv
    type: nodejs
    path: gen/srv
    requires:
      - name: cross-container-service-2
      - name: BWZ_User_Statistics-auth
      # - name: BWZ_User_Statistics-db
    provides:
      - name: srv-api
        properties:
          srv-url: ${default-url}
    parameters:
      buildpack: nodejs_buildpack
      readiness-health-check-http-endpoint: /health
      readiness-health-check-type: http
    build-parameters:
      builder: npm
  - name: BWZ_User_Statistics-db-deployer
    type: hdb
    path: gen/db
    requires:
      # - name: cross-container-service-1
      #   properties:
      #     TARGET_CONTAINER: ~{hdi-container-name}
      - name: cross-container-service-2
        # group: SERVICE_REPLACEMENTS
        properties:
          # key: ServiceName_1
          # service: ~{the-service-name}
          TARGET_CONTAINER: ~{the-service-name}
      # - name: BWZ_User_Statistics-db
    parameters:
      buildpack: nodejs_buildpack
  - name: BWZ_User_Statistics
    type: approuter.nodejs
    path: app/router
    requires:
      - name: srv-api
        group: destinations
        properties:
          forwardAuthToken: true
          name: srv-api
          url: ~{srv-url}
      - name: BWZ_User_Statistics-auth
    parameters:
      disk-quota: 256M
      keep-existing-routes: true
      memory: 256M
resources:
  # - name: cross-container-service-1
  #   type: org.cloudfoundry.existing-service
  #   parameters:
  #     service-name: hditest
  #   properties:
  #     hdi-container-name: ${service-name}
  - name: cross-container-service-2
    type: org.cloudfoundry.existing-service
    parameters:
      service-name: test_1
    properties:
      the-service-name: ${service-name}
  - name: BWZ_User_Statistics-auth
    type: org.cloudfoundry.managed-service
    parameters:
      service: xsuaa
      service-plan: application
      path: ./xs-security.json
      config:
        xsappname: BWZ_User_Statistics-${org}-${space}
        tenant-mode: dedicated
  # - name: BWZ_User_Statistics-db
  #   type: com.sap.xs.hdi-container
  #   parameters:
  #     service: hana
  #     service-plan: hdi-shared
parameters:
  enable-parallel-deployments: true
build-parameters:
  before-all:
    - builder: custom
      commands:
        - npm ci
        - npx cds build --production

Thanks in advance!

Accepted Solutions (0)

Answers (0)