Skip to Content
2
Aug 12, 2020 at 05:45 AM

SAP Cloud SDK executeHttpRequest Request failed with status code 407

4561 Views

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 [Nest] 81   - 08/12/2020, 5:25:21 AM   [ExceptionsHandler] Request failed with status code 407 +661ms
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!