cancel
Showing results for 
Search instead for 
Did you mean: 

How to access application with app/router

grathi1988
Associate
Associate
0 Kudos
125

I have build 2 UI5 apps. one with app/router and one without app/router folder configuration.

I deployed both the apps, but I am unable to access application with app/router. Is there any extra config changes I need to do apps with app/router in mta.yaml?

grathi1988_0-1726781882441.png

 

Staging application "SourcingTool"...
Application "SourcingTool-db-deployer" staged
Application "SourcingTool-srv" staged
Executing task "deploy" on application "SourcingTool-db-deployer"...
Starting application "SourcingTool-srv"...
Application "SourcingTool" staged
Application "SourcingTool-srv" started and available at "******-hello-gcp-2ew6xm6d-gcp-dev-sourcingtool-srv.cfapps.us30.hana.ondemand.com"
Starting application "SourcingTool"...
Application "SourcingTool" started and available at "*****-hello-gcp-2ew6xm6d-gcp-dev-sourcingtool.cfapps.us30.hana.ondemand.com"
Skipping deletion of services, because the command line option "--delete-services" is not specified.
Process finished.
Use "cf dmol -i ca78d1e5-76ad-11ef-8765-eeee0a8b050c" to download the logs of the process.

 

 

here is my mta.yaml.

 

 

_schema-version: 3.3.0
ID: SourcingTool
description: A simple CAP project.
version: 1.0.0
modules:
- name: SourcingTool-srv
  type: nodejs
  path: gen/srv
  requires:
  - name: SourcingTool-db
  - name: SourcingTool-uaa
  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: SourcingTool-db-deployer
  type: hdb
  path: gen/db
  requires:
  - name: SourcingTool-db
  parameters:
    buildpack: nodejs_buildpack
- name: SourcingTool
  type: approuter.nodejs
  path: app/router
  requires:
  - name: srv-api
    group: destinations
    properties:
      forwardAuthToken: true
      name: srv-api
      url: ~{srv-url}
  - name: SourcingTool-uaa
  - name: SourcingTool-destination
    group: destinations
    properties:
      forwardAuthToken: false
      name: ui5
      url: https://ui5.sap.com
  parameters:
    disk-quota: 1024M
    keep-existing-routes: true
    memory: 512M
- name: SourcingTool-destinations
  type: com.sap.application.content
  requires:
  - name: SourcingTool-uaa
    parameters:
      service-key:
        name: SourcingTool-uaa-key
  - name: SourcingTool-html5-repo-host
    parameters:
      service-key:
        name: SourcingTool-html5-repo-host-key
  - name: srv-api
  - name: SourcingTool-destination
    parameters:
      content-target: true
  parameters:
    content:
      instance:
        destinations:
        - Authentication: OAuth2UserTokenExchange
          Name: SourcingTool-app-srv
          TokenServiceInstanceName: SourcingTool-uaa
          TokenServiceKeyName: SourcingTool-uaa-key
          URL: ~{srv-api/srv-url}
          sap.cloud.service: SourcingTool.service
        - Name: SourcingTool-html5-repo-host
          ServiceInstanceName: SourcingTool-html5-repo-host
          ServiceKeyName: SourcingTool-html5-repo-host-key
          sap.cloud.service: SourcingTool.service
        - Authentication: OAuth2UserTokenExchange
          Name: SourcingTool-uaa
          ServiceInstanceName: SourcingTool-uaa
          ServiceKeyName: SourcingTool-uaa-key
          sap.cloud.service: SourcingTool.service
        existing_destinations_policy: update
  build-parameters:
    no-source: true
- name: SourcingTool-app-content
  type: com.sap.application.content
  path: .
  requires:
  - name: SourcingTool-html5-repo-host
    parameters:
      content-target: true
  build-parameters:
    build-result: resources
    requires:
    - artifacts:
      - comsourcingtoolsourcingtool.zip
      name: comsourcingtoolsourcingtool
      target-path: resources/
- name: comsourcingtoolsourcingtool
  type: html5
  path: app/sourcingtool
  build-parameters:
    build-result: dist
    builder: custom
    commands:
    - npm install
    - npm run build:cf
    supported-platforms: []
resources:
- name: SourcingTool-db
  type: com.sap.xs.hdi-container
  parameters:
    service: hana
    service-plan: hdi-shared
- name: SourcingTool-uaa
  type: org.cloudfoundry.managed-service
  parameters:
    config:
      role-collections:
      - description: ToolsAdmin
        name: ToolsAdmin
        role-template-references:
        - $XSAPPNAME.ToolsAdmin
      tenant-mode: dedicated
      xsappname: SourcingTool-${org}-${space}
    path: ./xs-security.json
    service: xsuaa
    service-plan: application
- name: SourcingTool-destination
  type: org.cloudfoundry.managed-service
  parameters:
    config:
      HTML5Runtime_enabled: true
      init_data:
        instance:
          destinations:
          - Authentication: NoAuthentication
            Name: ui5
            ProxyType: Internet
            Type: HTTP
            URL: https://ui5.sap.com
          existing_destinations_policy: update
    service: destination
    service-plan: lite
- name: SourcingTool-html5-repo-host
  type: org.cloudfoundry.managed-service
  parameters:
    service: html5-apps-repo
    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

 

 

View Entire Topic
umasaral
Active Participant
0 Kudos

Hi

Please check this 

Correct Path: Ensure `path: app/router` points to the right folder with `xs-app.json`.

2. Check `xs-app.json`: Confirm it has correct routes configured.

3. Destinations: Verify that all required destinations (like `srv-api`) are properly set up and accessible.

4. Health Checks: Ensure readiness checks are configured for the app router.

5. Review Logs: Check application logs for specific errors during startup or access attempts.

Redeploy the MTA after verifying these points.

grathi1988
Associate
Associate
0 Kudos

This is my xs-app.json

{
  "authenticationMethod": "route",
  "logout": {
    "logoutEndpoint": "/app-logout",
    "logoutPage": "/"
  },
  "routes": [
    {
      "source": "^/app/(.*)$",
      "target": "$1",
      "localDir": ".",
      "cacheControl": "no-cache, no-store, must-revalidate",
      "authenticationType": "xsuaa"
    },
    {
      "source": "^/appconfig/",
      "localDir": ".",
      "cacheControl": "no-cache, no-store, must-revalidate"
    },
    {
      "source": "^/user-api(.*)",
      "target": "$1",
      "service": "sap-approuter-userapi"
    },
    {
      "source": "^/(.*)$",
      "target": "$1",
      "destination": "srv-api",
      "csrfProtection": true,
      "authenticationType": "xsuaa"
    }
  ]
}