cancel
Showing results for 
Search instead for 
Did you mean: 

I can't deploy my xsuaa instance in my CAP application

emorales
Explorer
0 Kudos
204

Hello community, I have a problem and I need your help to fix it.

I have a CAP application that I want to deploy to my Cloud Foundry space. I have my MTA build and when I deployed it I got this error:

#2.0#2024 08 07 12:29:04.173#Z#WARN#com.sap.cloud.lm.sl.xs2.989609fb-54b8-11ef-bbb5-eeee0a961887.OPERATION.UpdateServiceParametersTask#
######org.cloudfoundry.multiapps.controller.persistence.services.ProcessLogger########flowable-async-job-executor-thread-29393###
[UpdateServiceParametersStep] Updating service "auditoria-auth" failed: Service broker error: Service broker xsuaa failed with: Could not find xsapp entry for auditoria-auth-769f798etrial_emorales-ebwzszn2-dev!t311742#

#2.0#2024 08 07 12:29:04.178#Z#DEBUG#com.sap.cloud.lm.sl.xs2.989609fb-54b8-11ef-bbb5-eeee0a961887.OPERATION.UpdateServiceParametersTask#
######org.cloudfoundry.multiapps.controller.persistence.services.ProcessLogger########flowable-async-job-executor-thread-29393###
[UpdateServiceParametersStep] Last operation for service "auditoria-auth": {
  "type" : "UPDATE",
  "description" : "Service broker error: Service broker xsuaa failed with: Could not find xsapp entry for auditoria-auth-769f798etrial_emorales-ebwzszn2-dev!t311742",
  "state" : "SUCCEEDED"
}#

I think my problem is in my xs-security.json file, with the "xsappname" property, but I don't see the problem at first glance, can anyone tell me what could be happening?

I share with you my xs-security.json

{
  "xsappname": "auditoria",
  "tenant-mode": "dedicated",
  "scopes": [
    {
      "name": "$XSAPPNAME.Auditor",
      "description": "Auditor"
    }
  ],
  "attributes": [],
  "role-templates": [
    {
      "name": "Auditor",
      "description": "generated",
      "scope-references": [
        "$XSAPPNAME.Auditor"
      ],
      "attribute-references": []
    }
  ],
  "oauth2-configuration": {
    "credential-types": [
      "binding-secret",
      "x509"
    ],
    "redirect-uris": [
      "https://*.applicationstudio.cloud.sap/**",
      "https://*.hana.ondemand.com/**"
    ]
  }
}

 And I also share with you my mta.yaml:

_schema-version: '3.1'
ID: auditoria
version: 1.0.0
description: "A simple CAP project."
parameters:
  enable-parallel-deployments: true
build-parameters:
  before-all:
    - builder: custom
      commands:
        - npm ci
        - npx cds build --production
modules:
  - name: auditoria-srv
    type: nodejs
    path: gen/srv
    parameters:
      buildpack: nodejs_buildpack
      memory: 256MB
      readiness-health-check-type: http
      readiness-health-check-http-endpoint: /health
    build-parameters:
      builder: npm
    provides:
      - name: srv-api # required by consumers of CAP services (e.g. approuter)
        properties:
          srv-url: ${default-url}
    requires:
      - name: auditoria-auth
      - name: auditoria-db

  - name: auditoria-db-deployer
    type: hdb
    path: gen/db
    parameters:
      buildpack: nodejs_buildpack
      memory: 256MB
    requires:
      - name: auditoria-db

  - name: auditoria
    type: approuter.nodejs
    path: app/router
    parameters:
      keep-existing-routes: true
      disk-quota: 256M
      memory: 256M
    build-parameters:
      ignore: ["default-env.json", ".env"]
    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: auditoria-auth

resources:
  - name: auditoria-auth
    type: org.cloudfoundry.managed-service
    parameters:
      service: xsuaa
      service-plan: application
      path: ./xs-security.json
      config:
        xsappname: auditoria-auth-${org}-${space}
        tenant-mode: dedicated

  - name: auditoria-db
    type: com.sap.xs.hdi-container
    parameters:
      config:
        schema: audit
      service: hana
      service-plan: hdi-shared

This problem appears within my cloud foundry space:

emorales_0-1723034163607.png
I can see the applications:

emorales_1-1723034209754.png

Anyone can help me? Thanks a lot !

View Entire Topic
Dinu
Contributor

Drop the service auditoria-auth and deploy the mta again. The service was created with a different xsappname (mentioned in xs-security.json#2). In the mta, new xsappname is configured (mta.yaml#67).  Once the service is created xsappname cannot be changed.  So the deployment fails to update the service, you can delete the service and now have the service with the new name or delete the new name from mta.yaml#67. 

emorales
Explorer
0 Kudos

Thanks Dinu, I changed the property name in the mta.yaml and it worked fine. I thought my webapp would load as well, but no. I did some research and it turns out there are several settings to do in the mta to be able to use the html5 repository, but the tutorial (this is the last video in the series: https://developers.sap.com/tutorials/hana-cloud-cap-stored-proc.html?source=Developer_Community-Upsk...) that I've been following from Thomas Jung doesn't cover this. Do you have any guide to help me with this?