cancel
Showing results for 
Search instead for 
Did you mean: 

sap router navigation issue yaml file

0 Kudos

Hello community,

I have the following issue when i deploy with Cli in CF. I defined the following yaml file definition in my project: (i added a little part of my yaml file)

As you check in the image, I'm selecting the host name with ${space}. My space called "MY_SPACE_1". So when I deploy the application router inside Cloud Foundry account, host is converted to: "my-space-1-server_out"

The issue is, when you try to navigate to router to "server_out" is appearing at 404 not found, The reason is, app router is trying to access to "MY_SPACE_1"

How can i fix this? My app router version is 6.4.1

Accepted Solutions (1)

Accepted Solutions (1)

mariusobert
Developer Advocate
Developer Advocate
0 Kudos

Hi,

I have a (long) answer for you 🙂

  • The issue is (more or less) expected because the variable "default-url" will be built before the "host" variable will be autocorrected (replace "_" with "-"). However, this behavior will be documented to avoid confusion in the future.
  • The engineer I spoke to said he "advises to be careful when to use read-only parameters default-xxx when host, domain or routes is used. These default-xxx parameters should be used for some use cases when parameters host, domain and routes are not used at all."
  • You can achieve the desired result by using the "routes" property instead:
- name: bookshop-srv
  type: nodejs
  path: srv
  parameters:
    memory: 512M
    disk-quota: 256M
    routes:
      - route: ${space}-bookshop-server.${default-domain}
  provides:
    - name: srv_api
      properties:
        url: "https://${routes/0/route}"

Many thanks,

Working for me 🙂

Answers (2)

Answers (2)

mariusobert
Developer Advocate
Developer Advocate
0 Kudos

Hi Javier,

I just tried to modify one of my projects and everything worked fine. I don't see a logical difference between my MTA.yaml and yours:

_schema-version: 2.0.0
ID: bookshop
version: 1.0.0
modules:
  - name: bookshop-db
    type: hdb
    path: db
    parameters:
      memory: 256M
      disk-quota: 256M
    requires:
      - name: bookshop-db-hdi-container
  - name: bookshop-srv
    type: nodejs
    path: srv
    parameters:
      memory: 512M
      disk-quota: 256M
      host: ${space}-bookshop-server
    provides:
      - name: srv_api
        properties:
          url: ${default-url}
    requires:
      - name: bookshop-db-hdi-container
  - name: bookshop-ui
    type: nodejs
    path: app
    parameters:
      memory: 256M
      disk-quota: 256M
      host: ${space}-bookshop-ui
    requires:
      - name: srv_api
        group: destinations
        properties: 
          forwardAuthToken: true
          strictSSL: true
          name: srv_api
          url: ~{url}
resources:
  - name: bookshop-db-hdi-container
    type: com.sap.xs.hdi-container
    properties:
      hdi-container-name: ${service-name}
    parameters:
      service: hanatrial


Are you also deploying your MTA to the trial landscape or to a production landscape?

0 Kudos

Hi Marius,

I'm deploying in a production landscape and my example is working without host parameter or even with host parameter without space variable added.

My suspicious is when you have a name in your "space name" which contain the character "_" is when is falling because is not possible to convert it. Did you try in a space which contain this character?. Let me show you a definition of my production app:

My space name is: DEV_CF_SPACE_OPEX_DS. And when you deploy convert the name as following:

and when you navigate says:

Many thanks 🙂

mariusobert
Developer Advocate
Developer Advocate
0 Kudos

Hi Javier,

you are absolutly right! This seems to be a bug. I'll instandly report it internally so I can get fixed.

Many thanks for letting us know! 🙂

0 Kudos

Many thanks to you for checking internally.

We need this for our project asap, so please if it is possible, let me know when is fixed. Once fixed, I'll be happy 🙂

mariusobert
Developer Advocate
Developer Advocate
0 Kudos

Hi Javier,

It's strange that you see this error message. I would have expected that the app router might fail because it seems that the intention of the line "-name: approuter_in" seems incorrect.

I've never used the ${space} variable (I actually didn't event know there is one) but the rest looks fine to me.

Is it a requirement to define the host for the server module for you? I usually use dynamic host names and that works out great (here's an example).

0 Kudos

Thanks Marius for your response.

For me your example is working, because i have the project similar that you have and is working perfectly, but please let me explain why i need this

The reason is because i need to generate a different url access per application in each environment and those environments contain different name of spaces. And i want to avoid autogeneration of urls, because if you don't define "host" parameter the url is autogenerated.

Maybe other solution is using an extension file, but the problem is in the way of transport in SCP, we're using TMS for SCP and with this method is not possible to add extension file in the moment of deploy.

Anyway, according to following documentation MTA, is possible to add ${space} to MTA in "host" parameter, because this is one of examples. But the behavior is strange because when you deploy with host name: ${space}-server_out, in CF is converted to my-space-server_out. However when you navigate with app router is not converting with same format, I think app router should change name with same name my-space-server_out, however is adding name of space directly MY_SPACE-server_out.

Please correct me, if i'm wrong and appreciate your help.