cancel
Showing results for 
Search instead for 
Did you mean: 

Error when trying to use XSUAA Hybrid mode

rizaldiramdlani
Explorer
0 Kudos

I created XSUAA instance for my app and bind it using cds bind for testing purpose. I've set user roles and everything including xs-security in app folder, when I run both app router and app instance (cds watch --profile hybrid) everything is fine and I can't access my odata service because it unauthorized(401). It should work when I access it through app router but it return error

Completed with status 500 Error while retrieving destination srv-api from destination service.

Bellow is my xs-security.json in app

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

Hope some of you know how to solve this, thanks.

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi rizaldi.ramdlani,

Does that happens when you call the catalog end-point or the end-user api end-point? Could you please state which urls produce the 500 error and what's the complete error messages (including where you started the cds watch program) from the console? Also, keep in mind that there is a 'code' button on the text editor here where you can paste code and console error messages which will not loose formating and it will be easier for use to read.

It is important to understand if you are getting a login screen while calling the app router's protected resource before getting any http errors in the application. If you are getting a login screen and some of the protected end-points do work well whereas other do not, please state that information as well.

It would also be a good idea to either share the project via github (if possible) or paste the 'code' for your mta.yaml file and any other source code that you may find relevant to the issue.

Best regards,
Ivan

rizaldiramdlani
Explorer
0 Kudos

Hi ivan.mirisola

- The URLs that produce the 500 error was the app router URL and not the service URL, If I use the service URL it will gives me 401 error.

- Yes I got login screen when I don't have sessions while accessing the APP Router URL, but after login and I tried to access my service catalog it throws me this error

Completed with status 500 Error while retrieving destination srv-api from destination service.

- As of now I don't think I can share the repo with you because it is private (Company Policy), but I can share with you the mta. yaml file bellow

_schema-version: "3.1"
ID: TaxIndonesia
description: A simple CAP project.
version: 1.0.0
modules:
- name: TaxIndonesia-srv
type: nodejs
path: srv
requires:
- name: TaxIndonesia-db
- name: uaa_TaxInd
- name: TaxIndonesia-cf-logging
- name: TaxIndonesia-destination
provides:
- name: srv-api
properties:
srv-url: ${default-url}
parameters:
buildpack: nodejs_buildpack
build-parameters:
builder: npm-ci
- name: TaxIndonesia-db-deployer
type: hdb
path: db
requires:
- name: TaxIndonesia-db
parameters:
buildpack: nodejs_buildpack
build-parameters:
ignore:
- default-env.json
- .env
- name: app
type: approuter.nodejs
path: app
requires:
- name: uaa_TaxInd
- name: srv-api
group: destinations
properties:
forwardAuthToken: true
name: srv-api
url: ~{srv-url}
- name: TaxIndonesia-launchpad-destination
group: destinations
properties:
forwardAuthToken: false
name: ui5
url: https://ui5.sap.com
parameters:
build-parameters: null
disk-quota: 1024M
ignore:
- default-env.json
- .env
memory: 512M
- name: TaxIndonesia-destinations
type: com.sap.application.content
requires:
- name: uaa_TaxInd
parameters:
service-key:
name: uaa_TaxInd-key
- name: TaxIndonesia-html5-repo-host
parameters:
service-key:
name: TaxIndonesia-repo-key
- name: srv-api
- name: TaxIndonesia-launchpad-destination
parameters:
content-target: true
parameters:
content:
instance:
destinations:
- Authentication: OAuth2UserTokenExchange
Name: TaxIndonesia-srv
TokenServiceInstanceName: uaa_TaxInd
TokenServiceKeyName: uaa_TaxInd-key
URL: ~{srv-api/srv-url}
sap.cloud.service: tax.service
- Name: TaxIndonesia-html5-repo-host
ServiceInstanceName: TaxIndonesia-html5-repo-host
ServiceKeyName: TaxIndonesia-repo-key
sap.cloud.service: tax.service
- Authentication: OAuth2UserTokenExchange
Name: uaa_TaxInd
ServiceInstanceName: uaa_TaxInd
ServiceKeyName: uaa_TaxInd-key
sap.cloud.service: tax.service
existing_destinations_policy: update
build-parameters:
no-source: true
- name: TaxIndonesia-app-content
type: com.sap.application.content
path: .
requires:
- name: TaxIndonesia-html5-repo-host
parameters:
content-target: true
build-parameters:
build-result: resources
requires:
- artifacts:
- supplieraddress.zip
name: supplieraddress
target-path: resources/
- artifacts:
- customeraddress.zip
name: customeraddress
target-path: resources/
- artifacts:
- taxnumber.zip
name: taxnumber
target-path: resources/
- artifacts:
- journalpajakmasukan.zip
name: journalpajakmasukan
target-path: resources/
- artifacts:
- fakturpajakmasukan.zip
name: fakturpajakmasukan
target-path: resources/
- name: supplieraddress
type: html5
path: app/supplier_address
build-parameters:
build-result: dist
builder: custom
commands:
- npm install
- npm run build:cf
supported-platforms:
[]
- name: customeraddress
type: html5
path: app/customer_address
build-parameters:
build-result: dist
builder: custom
commands:
- npm install
- npm run build:cf
supported-platforms:
[]
- name: taxnumber
type: html5
path: app/tax_number
build-parameters:
build-result: dist
builder: custom
commands:
- npm install
- npm run build:cf
supported-platforms:
[]
- name: journalpajakmasukan
type: html5
path: app/journal_pajak_masukan
build-parameters:
build-result: dist
builder: custom
commands:
- npm install
- npm run build:cf
supported-platforms:
[]
- name: fakturpajakmasukan
type: html5
path: app/faktur_pajak_masukan
build-parameters:
build-result: dist
builder: custom
commands:
- npm install
- npm run build:cf
supported-platforms:
[]
resources:
- name: TaxIndonesia-db
type: com.sap.xs.hdi-container
parameters:
service: hana
service-plan: hdi-shared
properties:
hdi-service-name: ${service-name}
- name: uaa_TaxInd
type: org.cloudfoundry.managed-service
parameters:
config:
role-collections:
- description: Manage Tax
name: TaxManager-${org}-${space}
role-template-references:
- $XSAPPNAME.TaxManager
- description: View Tax
name: TaxViewer-${org}-${space}
role-template-references:
- $XSAPPNAME.TaxViewer
tenant-mode: dedicated
xsappname: TaxIndonesia-${org}-${space}
path: ./xs-security.json
service: xsuaa
service-plan: application
- name: TaxIndonesia-cf-logging
type: org.cloudfoundry.managed-service
parameters:
service: application-logs
service-plan: lite
- name: TaxIndonesia-destination
type: org.cloudfoundry.managed-service
parameters:
service: destination
service-plan: lite
- name: TaxIndonesia-launchpad-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: TaxIndonesia-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:
- npx -p @sap/cds-dk cds build --production
- npm install --productio

Hope you can help me solve the issue thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

martinstenzig
Contributor
0 Kudos

Looking at your mta.yaml, I would be careful calling the app router module 'app' as that might be a reserved word somewhere. Either way. In order to figure out why your app router throws a 500, did you try a `cf logs app` before you execute the request. The log output will likely give you a clue why it blows up.

rizaldiramdlani
Explorer
0 Kudos

After I run the logs it seems it logging the app I deployed not the app that I run using the hybrid configuration. And when I use cds --bind --exec before I run the logs it shows me no output