cancel
Showing results for 
Search instead for 
Did you mean: 

CF Deployment Error: Error getting tenant t0

maximilian_pfab
Explorer

Hello Community & Experts,

I have a problem related to the deployment of my service.

The Hana Cloud is already linked via the instance mapping and the deployment has already been deployed once.

Now I get sporadically the following error, no matter if it's a fresh deployment or just an update:

 

 

 

2024-04-19T07:54:11.965+0000 [APP/PROC/WEB/0] STDOUT [cds] - loaded model from 1 file(s):
2024-04-19T07:54:11.965+0000 [APP/PROC/WEB/0] STDOUT ../deps/0/node_modules/@sap/cds-mtxs/db/t0.cds
2024-04-19T07:54:11.970+0000 [APP/PROC/WEB/0] STDOUT [mtx] - retrieving { tenants: [ 't0' ] } { uncached: [ 't0' ] }
2024-04-19T07:54:12.176+0000 [APP/PROC/WEB/0] STDOUT [mtx] - GET https://service-manager.cfapps.eu10.hana.ondemand.com/v1/service_offerings { params: { fieldQuery: "catalog_name eq 'hana'" } }
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR /home/vcap/deps/0/node_modules/@sap/cds-mtxs/srv/plugins/hana/srv-mgr.js:70
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR cds.error(_errorMessage(e, 'getting', tenant), { status: e.status ?? 500 })
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR ^
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR Error: Error getting tenant t0: Could not find service offering with catalog_name eq 'hana'
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR at get (/home/vcap/deps/0/node_modules/@sap/cds-mtxs/srv/plugins/hana/srv-mgr.js:70:9)
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR at async Object.acquire (/home/vcap/deps/0/node_modules/@sap/cds-mtxs/srv/plugins/hana/srv-mgr.js:58:16)
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR at async ApplicationService.<anonymous> (/home/vcap/deps/0/node_modules/@sap/cds-mtxs/srv/plugins/hana.js:63:38)
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR at async next (/home/vcap/deps/0/node_modules/@sap/cds/lib/srv/srv-dispatch.js:68:17)
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR at async ApplicationService.handle (/home/vcap/deps/0/node_modules/@sap/cds/lib/srv/srv-dispatch.js:66:10)
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR at async /home/vcap/deps/0/node_modules/@sap/cds-mtxs/srv/plugins/common.js:67:23
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR at async module.exports.resubscribeT0IfNeeded (/home/vcap/deps/0/node_modules/@sap/cds-mtxs/srv/plugins/common.js:65:5)
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR at async cds.emit (/home/vcap/deps/0/node_modules/@sap/cds/lib/index.js:13:62)
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR at async cds_server (/home/vcap/deps/0/node_modules/@sap/cds/server.js:40:3) {
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR status: 500
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR }
2024-04-19T07:54:12.246+0000 [APP/PROC/WEB/0] STDERR Node.js v18.19.1

 

 

 

This is my configuration of the MTA YAML File:

 

 

 

_schema-version: "3.1"
ID: myservice
version: 0.0.5
description: "CAP: Message Master Data Service"

parameters:
  enable-parallel-deployments: true
build-parameters:
  before-all:
    - builder: custom
      commands:
        - npm install --include=dev
        - npx cds build --production

modules:
  # --------------------- APP ROUTER ------------------------
  - name: myservice
  # ------------------------------------------------------------
    type: approuter.nodejs
    path: app/router
    build-parameters:
      builder: custom
      commands: []
      ignore: [ '.DS_Store', 'node_modules/', 'default-env.json', 'manifest*.yml' ]
    parameters:
      app-name: myservice-${space}
      app-domain: ${app-name}.${default-domain}
      keep-existing-routes: true
      disk-quota: 256M
      memory: 256M
    properties:
      TENANT_HOST_PATTERN: "^(.*)-${default-uri}"
    requires:
      - name: myservice-srv-api
        group: destinations
        properties:
          name: srv-api # must be used in xs-app.json as well
          url: ~{srv-url}
          forwardAuthToken: true
      - name: myservice-auth
      - name: myservice-destination
    provides:
      - name: myservice-router
        properties:
          app-protocol: ${protocol}
          app-url: ${default-url}
          app-uri: ${default-uri}
          app-domain: ${app-domain}
          application: ${app-name}

  # --------------------- SERVER MODULE ------------------------
  - name: myservice-srv
  # ------------------------------------------------------------
    type: nodejs
    path: gen/srv
    build-parameters:
      builder: npm
      ignore:
        - '.DS_Store'
        - 'node_modules/'
        - 'default-*.json'
        - 'manifest*.yml'
    parameters:
      app-name: myservice-srv-${space}
      app-domain: ${app-name}.${default-domain}
      buildpack: nodejs_buildpack
      memory: 256MB
      disk-quota: 2024MB
      keep-existing-routes: true
    requires:
      - name: myservice-auth
      - name: myservice-api-auth
      - name: myservice-db
      - name: myservice-destination
    provides:
      - name: myservice-srv-api # required by consumers of CAP services (e.g. approuter)
        properties:
          srv-url: ${default-url}
          srv-name: ${app-name}
          app-domain: ${app-domain}

  # ----------- MTX MODULE ----------
  - name: myservice-mtx
  # ------------------------------------------------------------
    type: nodejs
    path: gen/mtx/sidecar
    build-parameters:
      builder: npm-ci
      ignore:
        - '.DS_Store'
        - 'node_modules/'
        - 'default-*.json'
        - 'manifest*.yml'
    parameters:
      app-name: myservice-mtx-${space}
      memory: 128M
      disk-quota: 512MB
    properties:
      appName: ~{myservice-router/application}
      approuterUri: ~{myservice-router/app-uri}
      appDomain: ~{myservice-router/app-domain}
      brokerName: ~{myservice-sb-srv/app-name}
      brokerUrl: ~{myservice-sb-srv/srv-url}
      tenantSeparator: '-'
    requires:
      - name: myservice-srv-api
      - name: myservice-sb-srv
      - name: myservice-auth
      - name: myservice-db
      - name: myservice-registry
      - name: myservice-destination
      - name: myservice-service-manager-admin
      - name: myservice-router
    provides:
      - name: myservice-mtx-api
        properties:
          mtx-url: ${default-url}

  # ----------- BROKER MODULE (OSBAPI Implementation) ----------
  - name: myservice-sb
  # ------------------------------------------------------------
    type: nodejs
    path: broker
    build-parameters:
      builder: custom
      commands:
        []
      ignore:
        - '.DS_Store'
        - 'node_modules/'
        - 'default-*.json'
        - 'manifest*.yml'
    parameters:
      app-name: myservice-sb-${space}
      memory: 128MB
      disk-quota: 512MB
    properties:
      SBF_ENABLE_AUDITLOG: false
      SBF_CATALOG_FILE: ./catalog.json
      SBF_CATALOG_SUFFIX: ${space}-${org}
      SBF_SERVICE_CONFIG:
        myservice-api:
          extend_credentials:
            shared:
              apiUrl: ~{myservice-srv-api/srv-url}
          extend_xssecurity:
            per_plan:
              default:
                authorities:
                  - $XSMASTERAPPNAME.plan_default
          extend_catalog:
            metadata:
              displayName: Message Service API (${org} - ${space})
      SBF_BROKER_CREDENTIALS_HASH: >
        {
          "broker-user": "<Broker-Hash-PW>"
        }
    requires:
      - name: myservice-api-auth
      - name: myservice-srv-api
    provides:
      - name: myservice-sb-srv
        properties:
          app-name: ${app-name}
          srv-url: ${default-url}

resources:
  # ----------------- XSUAA - Service  -------------------------
  - name: myservice-auth
  # ------------------------------------------------------------
    type: org.cloudfoundry.managed-service
    properties:
      xsuaa-app: ${xsuaa-app}
      XSAPPNAME: ${xsuaa-app}
    parameters:
      service: xsuaa
      service-name: ${space}-myservice-auth
      service-plan: application
      path: ./xs-security.json
      xsuaa-app: myservice-${space}-${org}
      config:
        xsappname: ${xsuaa-app}
        tenant-mode: shared
    requires:
      - name: myservice-router

  # ----------------- XSUAA - Broker ----------------------------
  - name: myservice-api-auth
  # -------------------------------------------------------------
    type: org.cloudfoundry.managed-service
    properties:
      xsuaa-app: ${xsuaa-app}
    parameters:
      service: xsuaa
      service-name: ${space}-myservice-api-auth
      service-plan: broker
      xsuaa-app: myservice-api-${space}-${org}
      config:
        xsappname: ${xsuaa-app}

  # ----------------------- HDI SERVICE ------------------------
  - name: myservice-db
  # ------------------------------------------------------------
    type: org.cloudfoundry.managed-service
    parameters:
       service: service-manager
       service-name: ${space}-myservice-db
       service-plan: container
       service-tags:
        - "hana"
    properties:
      hdi-service-name: ${service-name}

  # ----------------- DESTINATION SERVICE ----------------------
  - name: myservice-destination
  # ------------------------------------------------------------
    type: org.cloudfoundry.managed-service
    parameters:
      service-plan: lite
      service-name: ${space}-myservice-destination
      service: destination

  # -------------- SERVICE MANAGER SERVICE ADMIN ---------------
  - name: myservice-service-manager-admin
  # ------------------------------------------------------------
    type: org.cloudfoundry.managed-service
    parameters:
      service: service-manager
      service-name: ${space}-myservice-service-manager-admin
      service-plan: subaccount-admin

  # ----------------------- MTX SERVICE ------------------------
  - name: myservice-registry
  # ------------------------------------------------------------
    type: org.cloudfoundry.managed-service
    requires:
      - name: myservice-auth
      - name: myservice-mtx-api
      - name: myservice-router
    parameters:
      service: saas-registry
      service-name: ${space}-myservice-registry
      service-plan: application
      config:
        xsappname: ~{myservice-auth/xsuaa-app}
        appName: ~{myservice-auth/xsuaa-app}
        displayName: 'Message Service (${org} - ${space})'
        description: >
          A service to get the Message + Texts.
        category: 'Custom'
        appUrls:
          getDependencies: ~{myservice-mtx-api/mtx-url}/-/cds/saas-provisioning/dependencies
          onSubscription: ~{myservice-mtx-api/mtx-url}/-/cds/saas-provisioning/tenant/{tenantId}
          onSubscriptionAsync: true
          onUnSubscriptionAsync: true
          onUpdateDependenciesAsync: true
          callbackTimeoutMillis: 300000 # Increase if your deployments are taking longer than that
        appPlans:
          - name: default
            description: Default plan

 

 

 

Did anybody had those type of issue yet?

Dinu
Contributor
0 Kudos
What is the version of cds and mtx in the installation? Command "cds -v" would tell you the version installed.
Dinu
Contributor
0 Kudos
Do you see this error in the sidecar or in the main app?
sjain511
Explorer
0 Kudos
I have the same issue, i have two service managers and the deployment is very flaky.
View Entire Topic
maximilian_pfab
Explorer
0 Kudos

Only in the sidecar. The service is starting without any errors.
Service Startup:

2024-04-24T13:51:02.130+0000 [API/13] STDOUT Starting app with guid 16f17faa-fc97-4f74-8876-9b595e2847a6
2024-04-24T13:51:02.329+0000 [CELL/0] STDOUT Cell 72db40ae-8192-4f77-a8b5-be35f6790509 creating container for instance 44349cac-e1ab-441e-64c2-4411
2024-04-24T13:51:02.821+0000 [CELL/0] STDOUT Security group rules were updated
2024-04-24T13:51:02.884+0000 [CELL/0] STDOUT Cell 72db40ae-8192-4f77-a8b5-be35f6790509 successfully created container for instance 44349cac-e1ab-441e-64c2-4411
2024-04-24T13:51:03.279+0000 [CELL/0] STDOUT Downloading droplet...
2024-04-24T13:51:11.408+0000 [CELL/0] STDOUT Downloaded droplet (173.4M)
2024-04-24T13:51:11.408+0000 [CELL/0] STDOUT Starting health monitoring of container
2024-04-24T13:51:11.469+0000 [APP/PROC/WEB/0] STDOUT Invoking pre-start scripts.
2024-04-24T13:51:11.674+0000 [APP/PROC/WEB/0] STDOUT Invoking start command.
2024-04-24T13:51:12.116+0000 [APP/PROC/WEB/0] STDOUT > kronesdigitalmeda@0.0.5 start
2024-04-24T13:51:12.116+0000 [APP/PROC/WEB/0] STDOUT > cds-serve
2024-04-24T13:51:12.468+0000 [APP/PROC/WEB/0] STDOUT [cds] - loaded model from 1 file(s):
2024-04-24T13:51:12.469+0000 [APP/PROC/WEB/0] STDOUT srv/csn.json
2024-04-24T13:51:12.692+0000 [APP/PROC/WEB/0] STDOUT [cds] - connect to db > hana {
2024-04-24T13:51:12.692+0000 [APP/PROC/WEB/0] STDOUT sm_url: 'https://service-manager.cfapps.eu10.hana.ondemand.com',
2024-04-24T13:51:12.692+0000 [APP/PROC/WEB/0] STDOUT url: 'XXXX',
2024-04-24T13:51:12.692+0000 [APP/PROC/WEB/0] STDOUT clientid: 'XXXX',
2024-04-24T13:51:12.692+0000 [APP/PROC/WEB/0] STDOUT clientsecret: '...',
2024-04-24T13:51:12.692+0000 [APP/PROC/WEB/0] STDOUT xsappname: 'XXXX'
2024-04-24T13:51:12.692+0000 [APP/PROC/WEB/0] STDOUT }
2024-04-24T13:51:12.789+0000 [APP/PROC/WEB/0] STDOUT [cds] - using auth strategy {
2024-04-24T13:51:12.789+0000 [APP/PROC/WEB/0] STDOUT kind: 'xsuaa',
2024-04-24T13:51:12.789+0000 [APP/PROC/WEB/0] STDOUT impl: '../deps/0/node_modules/@sap/cds/lib/auth/jwt-auth'
2024-04-24T13:51:12.789+0000 [APP/PROC/WEB/0] STDOUT }
2024-04-24T13:51:12.873+0000 [APP/PROC/WEB/0] STDOUT [cds] - serving cds.xt.ModelProviderService { path: '/-/cds/model-provider' }
2024-04-24T13:51:13.086+0000 [APP/PROC/WEB/0] STDOUT [cds] - serving MessageMasterData {
2024-04-24T13:51:13.086+0000 [APP/PROC/WEB/0] STDOUT impl: 'srv/messagedata-service.js',
2024-04-24T13:51:13.086+0000 [APP/PROC/WEB/0] STDOUT path: '/odata/v4/message-master-data'
2024-04-24T13:51:13.086+0000 [APP/PROC/WEB/0] STDOUT }
2024-04-24T13:51:13.091+0000 [APP/PROC/WEB/0] STDOUT [cds] - server listening on { url: 'http://localhost:8080' }
2024-04-24T13:51:13.091+0000 [APP/PROC/WEB/0] STDOUT [cds] - launched at 4/24/2024, 1:51:12 PM, version: 7.8.2, in: 794.367ms
2024-04-24T13:51:17.935+0000 [CELL/0] STDOUT Container became healthy