I'm trying to build an OData client on SAP CF that would connect and get content from S4 on-prem system. I have followed this tutorial: https://developers.sap.com/group.s4sdk-js-cloud-foundry.html I have not created and deployed a custom destination and xs-uaa services. Instead I want to use to cFLP product destination and xs-uaa services. Deploying the ts client app works fine but GET query of https://odataclient-quick-antelope.cfapps.sap.hana.ondemand.com/business-partners gives back {} result and in logs I observe errors:
2019-11-24T11:18:18.22+0200 [APP/PROC/WEB/0] OUT {
"message": "Unable to build destination for service binding: Unable to find a service binding for given name \"uxt_928\"! Found the following bindings: cfservice-xsuaa-broker, cfservice-destination.",
"level": "warn",
"custom_fields": {
"package": "core",
"messageContext": "destination-accessor"
},
"logger": "sap-cloud-sdk-logger",
"timestamp": "2019-11-24T09:18:18.222Z",
"msg": "Unable to build destination for service binding: Unable to find a service binding for given name \"uxt_928\"! Found the following bindings: cfservice-xsuaa-broker, cfservice-destination.",
"written_ts": 1574587098222,
"written_at": "2019-11-24T09:18:18.222Z"
}
2019-11-24T11:18:18.22+0200 [APP/PROC/WEB/0] OUT {
"message": "Unable to match a specific XSUAA service instance to the given JWT. The following XSUAA instances are bound: cfservice-cf-service-<removed service ID>. The following one will be selected: cfservice-cf-service-<removed service ID>. This might produce errors in other parts of the system!",
"level": "warn",
"custom_fields": {
"package": "core",
"messageContext": "environment-accessor"
},
"logger": "sap-cloud-sdk-logger",
"timestamp": "2019-11-24T09:18:18.224Z",
"msg": "Unable to match a specific XSUAA service instance to the given JWT. The following XSUAA instances are bound: cfservice-cf-service-yosi03-<removed service ID>. The following one will be selected: cfservice-cf-service-<removed service ID>. This might produce errors in other parts of the system!",
"written_ts": 1574587098224,
"written_at": "2019-11-24T09:18:18.224Z"
}
The code is basically: controller:
import express from "express";
import { helloWorld } from "./hello-world-route";
import { indexRoute } from "./index-route";
import { businessPartners } from './business-partner-route';
class App {
public app: express.Application;
constructor() {
this.app = express();
this.config();
this.routes();
}
private config(): void {
this.app.use(express.json());
this.app.use(express.urlencoded({ extended: false }));
}
private routes(): void {
const router = express.Router();
router.get("/", indexRoute);
router.get("/hello", helloWorld);
router.get("/business-partners", businessPartners);
this.app.use("/", router);
}
}
export default new App().app;
service:
business-partner-route.ts
import { Request, Response } from 'express';
import { BusinessPartner } from '@sap/cloud-sdk-vdm-business-partner-service';
export async function businessPartners(req: Request, res: Response) {
getAllBusinessPartners4Deb()
.then(businessPartners => res.status(200).send(businessPartners))
.catch(error => res.status(500).send(error));
}
//This version is more cumbersome to breakpoint...
function getAllBusinessPartners(): Promise<BusinessPartner[]> {
return BusinessPartner.requestBuilder()
.getAll()
.execute({
destinationName: 'uxt_928'
});
}
//This version is more convenient to breakpoint...
function getAllBusinessPartners4Debug(): Promise<BusinessPartner[]> {
const reqBuilder = BusinessPartner.requestBuilder();
const getter = reqBuilder.getAll();
const resp = getter.execute({ destinationName: 'uxt_928'});
return resp;
}
xs-security.json
{
"xsappname": "odataClient",
"tenant-mode": "shared"
}
manifest.yml, (set for remote debug)
applications:
- name: odataClient
path: deployment/
buildpacks:
- nodejs_buildpack
memory: 256M
command: cd dist/ && node --inspect index.js
random-route: true
services:
- cfservice-destination
- cfservice-xsuaa-broker
really appreciate any suggestions. Thanks!
The logs you shared are indeed just warnings, not errors. If no destination binding with the given name was found, the SDK is looking for a destination of this name in the destination service. As there are no other logs regarding the destination service, the destination was probably found. Therefore, this is expected behaviour.
Still, the question remains why there is no data. To answer this, we would need to understand a little bit more about your setup. Are you sure there is data in your system? You said you are connecting to an on premise system. Are you using a cloud connector?