sorry we don't have a more detailed step by step guide, but I think it makes sense to extend the documentation.
Form the cds watch I guess you are using a CAP application. This should in principle be possible, but in order to minimize the sources of errors I would do the following:
- open the ssh tunnel
- just execute a node my-test.js
- add a copy of your VCAP_SERVICE variables to the process (dotenv lib)
- Remember to adjust port/host proxy in your VCAP_SERVICE to point to the local side of your tunnel
- in the "my-test.js" call getDestination() from the SDK and have a look (if you do not provide a user JWT here you have to use a basic auth destination)
- The destination should have a proxy config containing the local side and all necessary auth headers
- Execute a call using this destination. The request should use the proxy located in CF via the ssh tunnel
I made a E2E test in the context of an other project and this snippet worked for me:
//cf enable-ssh My-App
//cf ssh MyApp -L 4711:connectivityproxy.cf.sap.hana.ondemand.com:20003
const destination = await getDestination('MyDestination',{})
destination.proxyConfiguration = {
host:'localhost',
port:4711,
headers:destination.proxyConfiguration.headers,
protocol:destination.proxyConfiguration.protocol
}
const bps = await BusinessPartner.requestBuilder().getAll().top(3).execute(destination)
Best
Frank