on ‎2020 Aug 12 6:45 AM
Hi all,
I'm trying to use the function "executeHttpRequest" of the cloud SDK to create a request to my on premise backend system like this:
const token = retrieveJwt(request);
return await executeHttpRequest({destinationName:"MyDestination",jwt:token},request)
Unfortunately this results in a 407, which means my proxy authentication is missing. But when I get my destination before sending the request, I notice that the proxy authentication is available. I do this by using the following function:
const destination = await getDestinationFromDestinationService("MyDestination",{userJwt:token})
Any idea what I'm missing?
Here you have the full log from the request till the 407 error:
2020-08-12T05:25:21.194+0000 [APP/PROC/WEB/0] OUT {"message":"Attempting to retrieve destination from destination service.","level":"info","custom_fields":{"package":"core","messageContext":"destination-accessor"},"logger":"sap-cloud-sdk-logger","timestamp":"2020-08-12T05:25:21.194Z","msg":"Attempting to retrieve destination from destination service.","written_ts":1597209921194,"written_at":"2020-08-12T05:25:21.194Z"}
2020-08-12T05:25:21.195+0000 [APP/PROC/WEB/0] OUT {"message":"Unable to match a specific XSUAA service instance to the given JWT. The following XSUAA instances are bound: cloud-approuter!t44784. The following one will be selected: cloud-approuter!t44784. 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":"2020-08-12T05:25:21.195Z","msg":"Unable to match a specific XSUAA service instance to the given JWT. The following XSUAA instances are bound: cloud-approuter!t44784. The following one will be selected: cloud-approuter!t44784. This might produce errors in other parts of the system!","written_ts":1597209921195,"written_at":"2020-08-12T05:25:21.195Z"}
2020-08-12T05:25:21.438+0000 [APP/PROC/WEB/0] OUT {"message":"Successfully retrieved destination from destination service.","level":"info","custom_fields":{"package":"core","messageContext":"destination-accessor"},"logger":"sap-cloud-sdk-logger","timestamp":"2020-08-12T05:25:21.437Z","msg":"Successfully retrieved destination from destination service.","written_ts":1597209921437,"written_at":"2020-08-12T05:25:21.437Z"}
2020-08-12T05:25:21.438+0000 [APP/PROC/WEB/0] OUT {"message":"OnPrem destination proxy settings from connectivity service will be used.","level":"info","custom_fields":{"package":"core","messageContext":"proxy-util"},"logger":"sap-cloud-sdk-logger","timestamp":"2020-08-12T05:25:21.438Z","msg":"OnPrem destination proxy settings from connectivity service will be used.","written_ts":1597209921438,"written_at":"2020-08-12T05:25:21.438Z"}
2020-08-12T05:25:21.589+0000 [APP/PROC/WEB/0] OUT {"message":"OnPrem destination proxy settings from connectivity service will be used.","level":"info","custom_fields":{"package":"core","messageContext":"proxy-util"},"logger":"sap-cloud-sdk-logger","timestamp":"2020-08-12T05:25:21.588Z","msg":"OnPrem destination proxy settings from connectivity service will be used.","written_ts":1597209921588,"written_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] OUT [31m[Nest] 81 - [39m08/12/2020, 5:25:21 AM [38;5;3m[ExceptionsHandler] [39m[31mRequest failed with status code 407[39m[38;5;3m +661ms[39m
2020-08-12T05:25:21.706+0000 [APP/PROC/WEB/0] OUT Error: Request failed with status code 407
2020-08-12T05:25:21.706+0000 [APP/PROC/WEB/0] OUT at 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] OUT at settle (/home/vcap/deps/0/node_modules/axios/lib/core/settle.js:17:12)
2020-08-12T05:25:21.706+0000 [APP/PROC/WEB/0] OUT at 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] OUT at IncomingMessage.emit (events.js:203:15)
2020-08-12T05:25:21.706+0000 [APP/PROC/WEB/0] OUT at endReadableNT (_stream_readable.js:1145:12)
2020-08-12T05:25:21.706+0000 [APP/PROC/WEB/0] OUT at process._tickCallback (internal/process/next_tick.js:63:19)
I'm also wondering why this shows up in the log "Unable to match a specific XSUAA service instance to the given JWT...." When looking at the decoded token and comparing it with the bound xsuaa service, it looks the same..
Thank you in advance!
Request clarification before answering.
Hello Wouter good morning,
what you do looks totally correct. Let's first investigate the 407 issue. The strange warning about the XSUAA is not nice but less important I guess.
Could you try one thing. When you fetch the destination using getDestinationFromDestinationService you can pass this object also directly to the executeHttpRequest(destination).
If it works then I know already that somethings goes wrong with the destination lookup inside the executeHttpRequest method. However, the same code is used to fetch destinations inside the executeHttpRequest and getDestinationFromDestinationService.
There is one difference though. In the executeHttpRequest a method called getDestination is used which does a destination lookup via (1) env variables (2) destination service instance (3) destination service. So you could also try if the result from getDestinationFromDestinationService and getDestination are different. If so you most likely have a destination defined in (1) or (2) and then this is taken if the name match of course.
Best
Frank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.