I'm trying to access an S/4HANA on Premise system via the Cloud Connector and SAP Cloud Platform connectivity service using the SAP Cloud SDK for JavaScript (version 1.5.0).
In detail, I have
- Cloud Connector
- connectivity service
- xsuaa service instance
- Application Router (app-router)
- destination
- destination service
which all work as expected. These preconditions are explained by different tutorials (https://blogs.sap.com/2019/04/02/a-do-it-yourself-at-home-guide-how-to-connect-a-node.js-app-on-sap-cloud-platform-for-the-cloud-foundry-to-an-s4hana-on-premise-system-securely-via-cloud-connector/, https://blogs.sap.com/2017/07/13/part-2-how-to-use-the-sap-cloud-platform-connectivity-and-the-cloud-connector-in-the-cloud-foundry-environment/).
With this setup I have no difficulties accessing an S/4HANA Cloud system. When using the SAP Cloud SDK for Java everything works as expected, i.e. I can access the on premise system. I have sufficient rights on the on premise system. Basic Authentication is used.
Example GET request for retrieving document info records using the SAP Cloud SDK JavaScript:
let destination = await useOrFetchDestination({
destinationName: 'MY_DESTINATION',
jwt: 'MY_JWT' });
DocumentInfoRecord.requestBuilder()
.getAll()
.execute(destination);
But testing against an on premise system makes the GET request fail with status code 503:
ERR Error: get request failed!
ERR at Object.errorWithCause (/path-to-app/node_modules/@sap/cloud-sdk-util/dist/error.js:14:20)
ERR at specializeError (/path-to-app/@sap/cloud-sdk-core/dist/request-builder/request/odata-request.js:175:32)
ERR at /path-to-app/@sap/cloud-sdk-core/dist/request-builder/request/odata-request.js:162:58
ERR at processTicksAndRejections (internal/process/task_queues.js:86:5)
ERR Caused by:
ERR Error: Request failed with status code 503
ERR at createError (/path-to-app/axios/lib/core/createError.js:16:15)
ERR at settle (/path-to-app/axios/lib/core/settle.js:17:12)
ERR at IncomingMessage.handleStreamEnd (/path-to-app/axios/lib/adapters/http.js:237:11)
ERR at IncomingMessage.emit (events.js:198:15)
ERR at endReadableNT (_stream_readable.js:1139:12)
ERR at processTicksAndRejections (internal/process/task_queues.js:81:17)
What might I have missed? Are additional HTTP headers necessary to make the request succeed?
UPDATE: added destination information to the code snippet and completed error message.
2nd UPDATE: The destination config looks similar to this:
Name: <MY_DESTINATION>
Type: HTTP
URL: http://... //this matches the cloud connector host, i.e. in SAP Cloud Platform Cockpit --> Cloud Connectors --> Exposed Back-End Systems
ProxyType: OnPremise
Authentication: BasicAuthentication
User: <USERNAME>
Password: <PASSWORD>