1

trying to install the approuter currently, following this tutorial:

https://blogs.sap.com/2017/07/18/step-7-with-sap-s4hana-cloud-sdk-secure-your-application-on-sap-cloud-platform-cloudfoundry/

When pushing the approuter to CF, I get an destination error:

xs-app.json/routes/0: Format validation failed (Route references unknown destination "service-destination")

This is my manifest.yml:

---
applications:
- name: xyz
  command: 'node approuter/approuter.js'
  host: xyz-93deb1cd-7b72-4060-94e7-21342342
  path: approuter
  memory: 128M
  buildpack: https://github.com/cloudfoundry/nodejs-buildpack
  env:
    TENANT_HOST_PATTERN: 'xyz(.*).cfapps.eu10.hana.ondemand.com'
    destinations: "[{"name":"service-destination", "url": "https://gfuowbasdatq19agtuthorizations-srv.cfapps.eu10.hana.ondemand.com", "forwardAuthToken": true}]"
    SAP_JWT_TRUST_ACL: '[{"clientid" : "*", "identityzone" : "*"}]'

  services:
    - my-xsuaa
    - service-destination

This is my xs-app.json:

{
  "routes": [{
    "source": "/",
    "target": "/",
    "destination": "service-destination"
  }]
}

Where is the application actually searching for this destination? I created it in my CF-account as well, pointing to my service-url.

Sander Wozniak
  • 650
  • 8
  • 27
RNLS0176
  • 115
  • 4
  • 13
  • 1
    The `destination` mentioned in your `xs-app.json` is searched for in the `destinations` environment variable, specified in your `manifest.yml`. So, in theory, it should work the way you show it. Can you maybe replace the double quotes surrounding the value of `destinations` variable with single quotes? This might cause issues with yaml. – Christoph Schubert Apr 26 '19 at 09:50
  • @ChristophSchubert: This solved the destination issue, but now getting "2019-04-26T15:28:30.37+0200 [APP/PROC/WEB/0] ERR /home/vcap/app/approuter/lib/environment.js:19 2019-04-26T15:28:30.37+0200 [APP/PROC/WEB/0] ERR throw new Error('File not found ' + xsappFile); 2019-04-26T15:28:30.37+0200 [APP/PROC/WEB/0] ERR ^ 2019-04-26T15:28:30.37+0200 [APP/PROC/WEB/0] ERR Error: File not found /home/vcap/app/xs-app.json" – RNLS0176 Apr 26 '19 at 13:34
  • 1
    Please open new questions for new issues, thank you. Also you might answer your question here and accept it to signal that this issue is solved. Thank you. – Florian Wilhelm Apr 26 '19 at 14:40

1 Answers1

0

In YAML (as well as many other markup languages, e.g. JSON) double quotes inside double quotes need to be escaped. (Cf. the YAML spec section 7.3.1 and this blog post)

So for you there are two options for your destinations variable: 1. Replacing all " inside with \" (relatively cumbersome, especially if you want to change the destinations in the future) 2. Use single quotes as boundaries. So the value of your destinations variable would look like this:

'[{"name":"service-destination", "url": "https://gfuowbasdatq19agtuthorizations-srv.cfapps.eu10.hana.ondemand.com", "forwardAuthToken": true}]'
Christoph Schubert
  • 1,089
  • 1
  • 8
  • 16