cancel
Showing results for 
Search instead for 
Did you mean: 

BTP: Odata v2 metadata not loaded in portal

former_member729305
Participant

Dear all,

in our current app we use an OData v2 and v4 model which are both working fine locally with the v2 proxy and the suffix "v2". When deploying this to the portal service in your space on the SAP BTP the OData v2 metadata is not loaded and throws an Internal Server Error - 500.

Does anyone know how to solve this? (xs-app.json and manifest are attached)

Does the portal service only work with OData v4? trying several sources as routes for odata v2 inside the xs-app.json was not successfull yet.

app specific manifest:

"dataSources": {
			"mainService": {
				"uri": "service/",
				"type": "OData",
				"settings": {
					"odataVersion": "4.0"
				}
			},
			"mainService-v2": {
				"uri": "v2/service/",
				"type": "OData",
				"settings": {
					"odataVersion": "2.0"
				}
			}
		},



"models": {
			
			"": {
				"dataSource": "mainService",
				"preload": true,
				"settings": {
					"synchronizationMode": "None",
					"operationMode": "Server",
					"autoExpandSelect": true,
					"earlyRequests": true
				}
			},
			"v2": {
				"dataSource": "mainService-v2",
				"preload": true,
				"settings": {
					"defaultBindingMode": "TwoWay"
				}
			}
		},<br>

app specific xs-app.json:

{
    "welcomeFile": "/index.html",
    "authenticationMethod": "route",
    "logout": {
      "logoutEndpoint": "/do/logout"
    },
    "routes": [
      {
        "authenticationType": "none",
        "csrfProtection": false,
        "source": "^/service/",
        "destination": "my-service"
      },
      {
        "authenticationType": "none",
        "csrfProtection": false,
        "source": "^/v2/service/",
        "destination": "my-service"
      },
      {
        "authenticationType": "none",
        "csrfProtection": false,
        "source": "^/v2/service/(.*)$",
        "destination": "my-service"
      },
      {
        "source": "^(.*)$",
        "target": "$1",
        "service": "html5-apps-repo-rt",
        "authenticationType": "xsuaa"
      }
    ]
  }<br>
raghavendraa
Explorer
0 Kudos

Facing same Issue, any solution for this

View Entire Topic
nicorunge
Participant
0 Kudos

Hi,

I had a similar problem a while ago. Does your cap service has a binding to a destination service defined in your mta.yaml? In my case this solved the metadata loading error on the frontend.

modules:
- name: myApp-srv
type: nodejs
path: gen/srv
requires:
- name: myApp-destination

resources:
- name: myApp-destination
type: org.cloudfoundry.managed-service
parameters:
service-plan: lite
service: destination

BR
Nico

former_member729305
Participant
0 Kudos

hey nicorunge,

thanks for your comment 😉

my destination service instance is already bound to my cap service. Did you face the same issue with a v2 odata service? I assume my xs-app.json has to be adjusted in some way..

nicorunge
Participant
0 Kudos

Hi Max,

yup, had the same when using v2 odata service. OData v4 was working fine.
Here's my xs-app.json:

      {
"source": "/user-api/currentUser$",
"target": "/currentUser",
"service": "sap-approuter-userapi"
},
{
"source": "^/v2/mypath/(.*)$",
"target": "/v2/mypath/$1",
"destination": "myapp-srv",
"authenticationType": "xsuaa",
"csrfProtection": true
},
{
"source": "^(.*)$",
"target": "$1",
"service": "html5-apps-repo-rt",
"authenticationType": "xsuaa"
}

Are you using a standalone approuter or the managed approuter?

BR
Nico