SAP Cloud SDK executeHttpRequest请求失败,状态码为407

2020-08-13 11:44发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


大家好,

我正在尝试使用云SDK的" executeHttpRequest"功能向我的内部后端系统创建请求,如下所示:

 const令牌= retrieveJwt(request);
 返回等待executeHttpRequest({destinationName:" MyDestination",jwt:token},request)

不幸的是,这导致407,这意味着我的代理身份验证丢失。 但是,在发送请求之前到达目的地时,我注意到代理身份验证可用。 我通过使用以下功能来做到这一点:

 const destination =等待getDestinationFromDestinationService(" MyDestination",{userJwt:token})
 

知道我缺少什么吗?

在这里您具有从请求到407错误的完整日志:

 2020-08-12T05:25:21.194 + 0000 [APP/PROC/WEB/0] OUT {" message":"正在尝试从目标服务中检索目标。"," level":" info"," custom_fields  ":{" package":" core"," messageContext":" destination-accessor"}," logger":" sap-cloud-sdk-logger"," timestamp":" 2020-08-12T05:25:21.194  Z"," msg":"正在尝试从目标服务中检索目标。"," write_ts":1597209921194," write_at":" 2020-08-12T05:25:21.194Z"}
 2020-08-12T05:25:21.195 + 0000 [APP/PROC/WEB/0] OUT {" message":"无法将特定的XSUAA服务实例与给定的JWT匹配。绑定了以下XSUAA实例:cloud-approuter  !t44784。将选择以下内容:cloud-approuter!t44784。这可能会在系统的其他部分产生错误!"," level":" warn"," custom_fields":{" package":" core",  " messageContext":"环境访问者"},"记录器":" sap-cloud-sdk-logger","时间戳":" 2020-08-12T05:25:21.195Z"," msg":"无法匹配 给定JWT的特定XSUAA服务实例。绑定了以下XSUAA实例:cloud-approuter!t44784。将选择以下实例:cloud-approuter!t44784。这可能会在系统的其他部分产生错误!","  created_ts":1597209921195," write_at":" 2020-08-12T05:25:21.195Z"}
 2020-08-12T05:25:21.438 + 0000 [APP/PROC/WEB/0] OUT {" message":"已成功从目标服务中检索到目标。","级别":" info"," custom_fields":{"  package":" core"," messageContext":" destination-accessor"}," logger":" sap-cloud-sdk-logger"," timestamp":" 2020-08-12T05:25:21.437Z","  msg":"已成功从目标服务中检索到目标。"," write_ts":1597209921437," write_at":" 2020-08-12T05:25:21.437Z"}
 2020-08-12T05:25:21.438 + 0000 [APP/PROC/WEB/0] OUT {" message":"将使用来自连接服务的OnPrem目标代理设置。","级别":" info"," custom_fields  ":{" package":" core"," messageContext":" proxy-util"}," logger":" sap-cloud-sdk-logger"," timestamp":" 2020-08-12T05:25:21.438  Z"," msg":"将使用来自连接服务的OnPrem目标代理设置。"," write_ts":1597209921438," write_at":" 2020-08-12T05:25:21.438Z"}
 2020-08-12T05:25:21.589 + 0000 [APP/PROC/WEB/0] OUT {" message":"将使用来自连接服务的OnPrem目标代理设置。","级别":" info"," custom_fields  ":{" package":" core"," messageContext":" proxy-util"}," logger":" sap-cloud-sdk-logger"," timestamp":" 2020-08-12T05:25:21.588  Z"," msg":"将使用来自连接服务的OnPrem目标代理设置。"," write_ts":1597209921588," write_at":" 2020-08-12T05:25:21.588Z"}
 78XtjpPvNIvZGWQy2ToJhGpdF9fDZe5QDm3mVz_u_fLcFp42a417sGfCyY7UwS2faNL7PqZwH5amOsfzRZYkrLVixUk-TF6N1o6Xzv-4tPDOFD8fzV9Z6ItGzi3EOr5ZXfn_y2QBHNAMJOou6Atrr-7x4Lb3z8d6YI7eKAjAdQgMZgWQ-KjTol6a9f2CEQExwCNZNQ7GFUxIAav4xhDFjUMEQ"}}}
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0]出[31m [嵌套] 81-[39m08/12/2020,5:25:21 AM [38; 5; 3m  [ExceptionsHandler] [39m [31mRequest失败,状态码为407 [39m [38; 5; 3m + 661ms [39m
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0] OUT错误:请求失败,状态码为407
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0]在createError处退出(/home/vcap/deps/0/node_modules/axios/lib/core/createError.js:16:15)
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0]在解决时退出(/home/vcap/deps/0/node_modules/axios/lib/core/settle.js:17:12)
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0]在IncomingMessage.handleStreamEnd(/home/vcap/deps/0/node_modules/axios/lib/adapters/http.js:236:11处退出 )
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0]在IncomingMessage.emit处退出(events.js:203:15)
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0]在endReadableNT处输出(_stream_visible.js:1145:12)
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0]在process._tickCallback退出(内部/进程/next_tick.js:63:19)
 

我还想知道为什么这会出现在日志"无法将特定的XSUAA服务实例与给定的JWT匹配...."中。当查看解码的令牌并将其与绑定的xsuaa服务进行比较时,它看起来 一样。

提前谢谢!

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


大家好,

我正在尝试使用云SDK的" executeHttpRequest"功能向我的内部后端系统创建请求,如下所示:

 const令牌= retrieveJwt(request);
 返回等待executeHttpRequest({destinationName:" MyDestination",jwt:token},request)

不幸的是,这导致407,这意味着我的代理身份验证丢失。 但是,在发送请求之前到达目的地时,我注意到代理身份验证可用。 我通过使用以下功能来做到这一点:

 const destination =等待getDestinationFromDestinationService(" MyDestination",{userJwt:token})
 

知道我缺少什么吗?

在这里您具有从请求到407错误的完整日志:

 2020-08-12T05:25:21.194 + 0000 [APP/PROC/WEB/0] OUT {" message":"正在尝试从目标服务中检索目标。"," level":" info"," custom_fields  ":{" package":" core"," messageContext":" destination-accessor"}," logger":" sap-cloud-sdk-logger"," timestamp":" 2020-08-12T05:25:21.194  Z"," msg":"正在尝试从目标服务中检索目标。"," write_ts":1597209921194," write_at":" 2020-08-12T05:25:21.194Z"}
 2020-08-12T05:25:21.195 + 0000 [APP/PROC/WEB/0] OUT {" message":"无法将特定的XSUAA服务实例与给定的JWT匹配。绑定了以下XSUAA实例:cloud-approuter  !t44784。将选择以下内容:cloud-approuter!t44784。这可能会在系统的其他部分产生错误!"," level":" warn"," custom_fields":{" package":" core",  " messageContext":"环境访问者"},"记录器":" sap-cloud-sdk-logger","时间戳":" 2020-08-12T05:25:21.195Z"," msg":"无法匹配 给定JWT的特定XSUAA服务实例。绑定了以下XSUAA实例:cloud-approuter!t44784。将选择以下实例:cloud-approuter!t44784。这可能会在系统的其他部分产生错误!","  created_ts":1597209921195," write_at":" 2020-08-12T05:25:21.195Z"}
 2020-08-12T05:25:21.438 + 0000 [APP/PROC/WEB/0] OUT {" message":"已成功从目标服务中检索到目标。","级别":" info"," custom_fields":{"  package":" core"," messageContext":" destination-accessor"}," logger":" sap-cloud-sdk-logger"," timestamp":" 2020-08-12T05:25:21.437Z","  msg":"已成功从目标服务中检索到目标。"," write_ts":1597209921437," write_at":" 2020-08-12T05:25:21.437Z"}
 2020-08-12T05:25:21.438 + 0000 [APP/PROC/WEB/0] OUT {" message":"将使用来自连接服务的OnPrem目标代理设置。","级别":" info"," custom_fields  ":{" package":" core"," messageContext":" proxy-util"}," logger":" sap-cloud-sdk-logger"," timestamp":" 2020-08-12T05:25:21.438  Z"," msg":"将使用来自连接服务的OnPrem目标代理设置。"," write_ts":1597209921438," write_at":" 2020-08-12T05:25:21.438Z"}
 2020-08-12T05:25:21.589 + 0000 [APP/PROC/WEB/0] OUT {" message":"将使用来自连接服务的OnPrem目标代理设置。","级别":" info"," custom_fields  ":{" package":" core"," messageContext":" proxy-util"}," logger":" sap-cloud-sdk-logger"," timestamp":" 2020-08-12T05:25:21.588  Z"," msg":"将使用来自连接服务的OnPrem目标代理设置。"," write_ts":1597209921588," write_at":" 2020-08-12T05:25:21.588Z"}
 78XtjpPvNIvZGWQy2ToJhGpdF9fDZe5QDm3mVz_u_fLcFp42a417sGfCyY7UwS2faNL7PqZwH5amOsfzRZYkrLVixUk-TF6N1o6Xzv-4tPDOFD8fzV9Z6ItGzi3EOr5ZXfn_y2QBHNAMJOou6Atrr-7x4Lb3z8d6YI7eKAjAdQgMZgWQ-KjTol6a9f2CEQExwCNZNQ7GFUxIAav4xhDFjUMEQ"}}}
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0]出[31m [嵌套] 81-[39m08/12/2020,5:25:21 AM [38; 5; 3m  [ExceptionsHandler] [39m [31mRequest失败,状态码为407 [39m [38; 5; 3m + 661ms [39m
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0] OUT错误:请求失败,状态码为407
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0]在createError处退出(/home/vcap/deps/0/node_modules/axios/lib/core/createError.js:16:15)
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0]在解决时退出(/home/vcap/deps/0/node_modules/axios/lib/core/settle.js:17:12)
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0]在IncomingMessage.handleStreamEnd(/home/vcap/deps/0/node_modules/axios/lib/adapters/http.js:236:11处退出 )
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0]在IncomingMessage.emit处退出(events.js:203:15)
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0]在endReadableNT处输出(_stream_visible.js:1145:12)
 2020-08-12T05:25:21.706 + 0000 [APP/PROC/WEB/0]在process._tickCallback退出(内部/进程/next_tick.js:63:19)
 

我还想知道为什么这会出现在日志"无法将特定的XSUAA服务实例与给定的JWT匹配...."中。当查看解码的令牌并将其与绑定的xsuaa服务进行比较时,它看起来 一样。

提前谢谢!

付费偷看设置
发送
8条回答
微wx笑
1楼-- · 2020-08-13 12:14

您好 Wouter Lemaire

如果您认为自己已发现错误,请随时创建我们的仓库并向其发布带有Frank要求的问题的问题。 他可能今天下午不上班。

我们很乐意调查并帮助您解决问题。

最好

Artem

SAP小菜
2楼-- · 2020-08-13 12:21

感谢目的地。 我试图重现该问题,但目前尚无法解决。 另一个对象是executeHttpRequest(destination,request)中的请求。 您是否也可以共享此对象,因为如果此请求的标头中包含"授权",则这也可能会干扰请求的创建:

https://github.com/SAP/cloud-sdk/blob/7b4523e58a66571c8f7270c00684ebc3c000f883/packages/core/src/header-builder/header-builder-for-destination.ts#L16 -L19

一周热门 更多>