cancel
Showing results for 
Search instead for 
Did you mean: 

No UAA configuration is provided in non-anonymous mode in HANA Node js module

0 Kudos

Hi all,

Good day..!

I am trying to build a Node.js (XSJS service and xsOdata service) for my UI5 application in HANA XSA Webide (HANA 2 SPS05) i have created the UAA xs-security.json file as below and added a instance in the HANA cockpit.

xs-security.json:

{
    "xsappname": "PAL_Customer360",
    "scopes": [
        {
            "name": "$XSAPPNAME.Display",
            "description": "display"
        },
        {
            "name": "$XSAPPNAME.Create",
            "description": "create"
        },
        {
            "name": "$XSAPPNAME.Edit",
            "description": "edit"
        },
        {
            "name": "$XSAPPNAME.Delete",
            "description": "delete"
        }
    ],
    "attributes": [
        {
            "name": "manager",
            "description": "manager",
            "valueType": "s"
        }
    ],
    "role-templates": [
        {
            "name": "Viewer",
            "description": "View all records",
            "scope-references": [
                "$XSAPPNAME.Display"
            ],
            "attribute-references": [
                "manager"
            ]
        },
        {
            "name": "Editor",
            "description": "Edit and Delete records",
            "scope-references": [
                "$XSAPPNAME.Create",
                "$XSAPPNAME.Edit",
                "$XSAPPNAME.Delete",
                "$XSAPPNAME.Display"
            ],
            "attribute-references": [
                "manager"
            ]
        }
    ]
}

and the same has binded with mta.yaml as below,

- name: xsjs_customer360
    type: nodejs
    path: xsjs_customer360
    requires:
      - name: db_cust360
      - name: hdi_db_cust360
      - name: PAL_Customer360-uaa
    provides:
      - name: xsjs_customer360_api
        properties:
          url: '${default-url}'
  - name: Z_Customer_360
    type: html5
    path: Z_Customer_360
    requires:
      - name: xsjs_customer360_api
        group: destinations
        properties:
          name: xsjs-backend
          url: '~{url}'
          forwardAuthToken: true
      - name: PAL_Customer360-uaa

and i commented out the anonymous mode in server.js as below,

/*eslint no-console: 0, no-unused-vars: 0*/
"use strict";


var xsjs  = require("@sap/xsjs");
var xsenv = require("@sap/xsenv");
var port  = process.env.PORT || 3000;


var options = {
	//anonymous : true, // remove to authenticate calls
	auditLog : { logToConsole: true }, // change to auditlog service for productive scenarios
	redirectUrl : "/index.xsjs"
};


// configure HANA
try {
	options = Object.assign(options, xsenv.getServices({ hana: {tag: "hana"} }));
} catch (err) {
	console.log("[WARN]", err.message);
}


// configure UAA
try {
	 options = Object.assign(options, xsenv.getServices({ uaa: {tag: "xsuaa"} }));
} catch (err) {
	console.log("[WARN]", err.message);
}


// start server
xsjs(options).listen(port);


console.log("Server listening on port %d", port);

When we make anonymous false or removed we are getting a error "No UAA configuration is provided in non-anonymous mode" as below,

And Made In the UI module i have added routing the xs-app.json as below,

{
	"welcomeFile": "webapp/index.html",
	"authenticationMethod": "route",
	"routes": [{
			"source": "(.*)(.xsjs)",
			"destination": "xsjs-backend",
			"csrfProtection": false,
			"authenticationType": "xsuaa"
		}, {
			"source": "(.*)(.xsodata)",
			"destination": "xsjs-backend",
			"authenticationType": "xsuaa"


		}, 
		{
			"source": "^/(.*)(.xsjs)",
			"destination": "xsjs-backend",
			"authenticationType": "xsuaa"
		},
		{
			"source": "^/xsodata/(.*)",
			"destination": "xsjs-backend",
			"authenticationType": "xsuaa",
			"scope" : "$XSAPPNAME.Display"
		},
		{
			"source": "^/(.*)$",
    		"localDir" : "resources"
		}


	]
}

When i run the UI Module we are facing the below error,

This above both error's happen only when i set anonymous :"false" or removed it, but working fine in anonymous : "true", Kindly help me fixing this error.

Thanks,

Bharani

Accepted Solutions (0)

Answers (1)

Answers (1)

jhodel18
Active Contributor
0 Kudos

Hi Bharani,

It looks like the error is correct:

No UAA configuration is provided in non-anonymous mode

Because I don't see any XSUAA service setup in your mta.yaml file. You need to add configuration for that service before you can use it for service binding.

0 Kudos

Hi Jhodel Cailan,

Thank you for your reply i have actually added that i forget mention that in the code,

ID: PAL_Customer360
_schema-version: '2.1'
version: 0.0.1
modules:
  - name: db_cust360
    type: hdb
    path: db_Customer360
    requires:
      - name: hdi_db_cust360
        properties:
          TARGET_CONTAINER: '~{hdi-container-name}'
      - name: BillingInvoicing-service
        group: SERVICE_REPLACEMENTS
        properties:
          key: BillingInvoicing-logical-view-service
          service: '~{BillingInvoicing-view-service}'
      - name: BizMD-service
        group: SERVICE_REPLACEMENTS
        properties:
          key: BizMD-logical-view-service
          service: '~{BizMD-view-service}'
      - name: s4hana-service
        group: SERVICE_REPLACEMENTS
        properties:
          key: S4Hana-logical-table-service
          service: '~{S4Hana-table-service}'
      - name: Finance-service
        group: SERVICE_REPLACEMENTS
        properties:
          key: Finance-logical-view-service
          service: '~{Finance-view-service}'
      - name: marketing-service
        group: SERVICE_REPLACEMENTS
        properties:
          key: marketing-logical-view-service
          service: '~{marketing-view-service}'
      - name: Device-service
        group: SERVICE_REPLACEMENTS
        properties:
          key: device-logical-view-service
          service: '~{Device-view-service}'
      - name: SalesService
        group: SERVICE_REPLACEMENTS
        properties:
          key: SalesService-logical-view-service
          service: '~{SalesService-view-service}'
      - name: PA_PaymentPropensity-service
        group: SERVICE_REPLACEMENTS
        properties:
          key: PA_PaymentPropensity-logical-view-service
          service: '~{PA_PaymentPropensity-view-service}'
      - name: PA_Abnormal_Consumption-service
        group: SERVICE_REPLACEMENTS
        properties:
          key: PA_Abnormal_Consumption-logical-view-service
          service: '~{PA_Abnormal_Consumption-view-service}'
  - name: xsjs_customer360
    type: nodejs
    path: xsjs_customer360
    requires:
      - name: db_cust360
      - name: hdi_db_cust360
      - name: PAL_Customer360-uaa
    provides:
      - name: xsjs_customer360_api
        properties:
          url: '${default-url}'
  - name: Z_Customer_360
    type: html5
    path: Z_Customer_360
    requires:
      - name: xsjs_customer360_api
        group: destinations
        properties:
          name: xsjs-backend
          url: '~{url}'
          forwardAuthToken: true
      - name: PAL_Customer360-uaa
  - name: zcust360_Comm
    type: html5
    path: zcust360_Comm
    requires:
      - name: xsjs_customer360_api
        group: destinations
        properties:
          name: xsjs-backend
          url: '~{url}'
          forwardAuthToken: true
      - name: PAL_Customer360-uaa
resources:
  - name: hdi_db_cust360
    parameters:
      service-name: PAL_Customer360
      config:
        schema: PAL_Customer360
        makeUniqueName: false
    properties:
      hdi-container-name: '${service-name}'
    type: com.sap.xs.hdi-container
  - name: BillingInvoicing-service
    parameters:
      service-name: BillingInvoicing
    properties:
      BillingInvoicing-view-service: '${service-name}'
    type: org.cloudfoundry.existing-service
  - name: BizMD-service
    parameters:
      service-name: Biz_MD
    properties:
      BizMD-view-service: '${service-name}'
    type: org.cloudfoundry.existing-service
  - name: s4hana-service
    parameters:
      service-name: Rep_S4_Hana
    properties:
      S4Hana-table-service: '${service-name}'
    type: org.cloudfoundry.existing-service
  - name: Finance-service
    parameters:
      service-name: Finance
    properties:
      Finance-view-service: '${service-name}'
    type: org.cloudfoundry.existing-service
  - name: marketing-service
    parameters:
      service-name: marketing
    properties:
      marketing-view-service: '${service-name}'
    type: org.cloudfoundry.existing-service
  - name: Device-service
    parameters:
      service-name: device
    properties:
      Device-view-service: '${service-name}'
    type: org.cloudfoundry.existing-service
  - name: SalesService
    parameters:
      service-name: salesservice
    properties:
      SalesService-view-service: '${service-name}'
    type: org.cloudfoundry.existing-service
  - name: PA_PaymentPropensity-service
    parameters:
      service-name: PA_PaymentPropensity
    properties:
      PA_PaymentPropensity-view-service: '${service-name}'
    type: org.cloudfoundry.existing-service
  - name: PA_Abnormal_Consumption-service
    parameters:
      service-name: PA_Abnormal_Consumption
    properties:
      PA_Abnormal_Consumption-view-service: '${service-name}'
    type: org.cloudfoundry.existing-service
  - name: PAL_Customer360-uaa
    type: com.sap.xs.uaa
    parameters:
      path: xs-security.json

Thanks,

Bharani

jhodel18
Active Contributor
0 Kudos

Hi Bharani,

Try creating the XSUAA manually from HANA Cockpit and then change your xsuaa mta.yaml configuration to:

  - name: lcp-uaa
    type: org.cloudfoundry.existing-service

And see if that works. I suspect that you haven't deployed your MTA project once, hence the XSUAA is not existing yet.

0 Kudos

Hi Jhodel Cailan,

Good day..!

I tried deploying the my mtar using "Deploy to XS Advance" because am using a on-premise system but while deploying i got an error,

"PAL_Customer360" will not be rebound to application "db_cust360" because the binding parameters are not modified".

Kindly help me fixing this.

Thanks,

Bharani

jhodel18
Active Contributor
0 Kudos

Hi Bharani,

It doesn't look like you have captured the actual error.

"PAL_Customer360" will not be rebound to application "db_cust360" because the binding parameters are not modified"