gpt4 book ai didi

sap-cloud-platform - 使用 SAP Cloud SDK JS 应用程序“无法为服务绑定(bind)构建目标”

转载 作者:行者123 更新时间:2023-12-02 00:49:12 27 4
gpt4 key购买 nike

我正在尝试在 SAP CF 上构建一个 OData 客户端,它可以连接 S4 本地系统并从中获取内容。我遵循了本教程:https://developers.sap.com/group.s4sdk-js-cloud-foundry.html我还没有创建和部署自定义目的地和 xs-uaa 服务。相反,我想使用 cFLP 产品目标和 xs-uaa 服务。部署 ts 客户端应用程序工作正常但 GET 查询 https://odataclient-quick-antelope.cfapps.sap.hana.ondemand.com/business-partners返回 {} 结果,在日志中我观察到错误:

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"
}

代码基本上是: 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;

服务:

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,(为远程调试设置)

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

非常感谢任何建议。谢谢!

最佳答案

您分享的日志确实只是警告,而不是错误。如果未找到具有给定名称的目标绑定(bind),则 SDK 将在目标服务中查找具有此名称的目标。由于没有关于目标服务的其他日志,因此可能找到了目标。因此,这是预期的行为。

仍然,问题仍然是为什么没有数据。要回答这个问题,我们需要更多地了解您的设置。您确定系统中有数据吗?您说您正在连接到内部部署系统。您使用的是云连接器吗?

关于sap-cloud-platform - 使用 SAP Cloud SDK JS 应用程序“无法为服务绑定(bind)构建目标”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59016548/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com