cancel
Showing results for 
Search instead for 
Did you mean: 

Run UI5 app with managed approuter in BAS

WouterLemaire
Active Contributor

Hi all,

I followed this blog post https://blogs.sap.com/2020/09/11/building-a-central-launchpad-using-sap-cloud-platform-launchpad-ser... of murali.shanmugham to create a UI5 app using the managed approuter. All works fine when deployed. But when I try to run directly from BAS, I'm getting the following message.

Any idea how to solve this?

Thank you all in advance!

Kr, Wouter

yuval_morad
Employee
Employee

Please create a service instance of xsuaa "application" plan from BAS via command "create service instance".

In run configuration connect to this instance.

Make sure you have one process running in local run for the project using port 6004

Contact me if it is not working

WouterLemaire
Active Contributor
0 Kudos

Thank you yuval.morad . But this is already the case. Tried creating a new service (just to be sure) ended up with the same result...

WouterLemaire
Active Contributor
0 Kudos

I get the following messages in BAS after opening my app

#2.0#2020 09 16 18:18:10:539#+00:00#INFO#/Auth/OAuth2#####d3873947-2800-444f-9ffc-3d4a3181d2c0####cbj-SrgxBS7Uj5HNnwOY6_M1JM02BipV######d3873947-2800-444f-9ffc-3d4a3181d2c0#PLAIN##req.url: /bewlExampleApp/index.html# #2.0#2020 09 16 18:18:10:541#+00:00#INFO#/Auth/OAuth2#####d3873947-2800-444f-9ffc-3d4a3181d2c0####cbj-SrgxBS7Uj5HNnwOY6_M1JM02BipV######d3873947-2800-444f-9ffc-3d4a3181d2c0#PLAIN##sending page with client-side redirect to https://2d32c6fatrial.authentication.eu10.hana.ondemand.com/oauth/authorize?response_type=code&clien... #2.0#2020 09 16 18:18:10:543#+00:00#INFO#/Auth/OAuth2#####d3873947-2800-444f-9ffc-3d4a3181d2c0####cbj-SrgxBS7Uj5HNnwOY6_M1JM02BipV######d3873947-2800-444f-9ffc-3d4a3181d2c0#PLAIN##x-forwarded-path header: undefined#
js2
Product and Topic Expert
Product and Topic Expert
0 Kudos

c3d1947136cd4c748a7aa794001af496 did you end up resolving this? I am finding that I also get this oauth redirect error when I run the app deployed in cloud foundry via the url.

If I run the app from within the Launchpad it works fine.

If I run the app via the url retreived from ``cf html5-list -u -d` then I get the same error you show here.

Accepted Solutions (1)

Accepted Solutions (1)

yuval_morad
Employee
Employee

I suspect you root package.json lacksdevDependency "@sap/approuter": "8.1.x", "@sap/html5-repo-mock": "1.5.x",

Or

The env file attached to launch.json used by your local run, does not include the right xsuaa

I hope you can access these links

Try this one I recorded 3 months ago E2E flow using central App Router
https://sap-my.sharepoint.com/:v:/p/yuval_morad/EaR7wmPE_xFDscHXBaBiXSEBxuVfgtICtOYdY5ZVbsqgsA?e=B6N...

This is local run

https://sap-my.sharepoint.com/:v:/p/yuval_morad/Efeu7z-wN2pNrA7u6b2hwsYBLvJMAIvwda65vHLcmYS0vw?e=d76...

WouterLemaire
Active Contributor
0 Kudos

Thanks yuval.morad , that works! Looks like the additional parameters when creating the xsuaa instance in BAS are very important 🙂 I created my service manually... Thanks again!

maissa93
Participant
0 Kudos

This is the exact issue that I am facing right now in spite of the proposed solutions here.

The issue is in run configuration is does not connect any instance nor datasource.

Can you share the .env file please where xsuaa is configured? I might have the wrong syntax.

roylerner3
Explorer
0 Kudos

Hi,

Does it work in trial account ?

I cant find neither the html5 tab under my workspace nor the given entitlements.

I deployed the newly built MTA file, I got some new service instances, but w/o routes/urls

"cf html5" command comes out empty from business studio.

Thanks.

yuval_morad
Employee
Employee
0 Kudos

The HTML5 menu in trial will probably come in Q1 this year.

Until then you can execute the from the terminal in BAS the following:

cf html5-list -di <destination service instance name in the mta> -u

Check my migration blog
https://blogs.sap.com/2021/01/14/migrating-sap-fiori-applications-from-neo-to-cloud-foundry-using-sa...

and formal documentation

https://help.sap.com/viewer/584e0bcbfd4a4aff91c815cefa0bce2d/Cloud/en-US/83b0fb23e37d456caad1ad0448e...

0 Kudos

Hello yuval.morad ,

How do we check if "The env file attached to launch.json used by your local run, does not include the right xsuaa" ? I am facing the same problem as listed above, I've added redirect_uris as well, but still I am getting the error. Also I did not define the run configuration for the destination but I have default-env.json file that has configuration for the destination.

yuval_morad
Employee
Employee
0 Kudos

You would need to describe your flow accurately:

1. Local run of Fiori app? for CF/ABAP? using managed approuter or standalone approuter

2. Which local run is used html5-repo-mock?

3. Reuse library consumption? from the same MTA or not

4. Data source consumption? from a destination of BE app in CF

5. Role test yes/not

In general this requirement of binding to XSUAA is not required anymore for local run using latest version in dev-dependency "@sap/html5-repo-mock": "2.0.x"

Answers (5)

Answers (5)

yuval_morad
Employee
Employee
0 Kudos

Please share the manifest.json xs-app.json and mta.yaml

are you running

Did you subscribe to portal or launchpad?

0 Kudos

Hi Yuval,

We are facing the same error - the invalid_uri has an invalid domain error for our CPI tenant while accessing them with a custom domain we created. And as it is not a UI5 app, we are not aware where to find xs-security.json file for CPI tenant in BTP CF cockpit. Can you please help here

yuval_morad
Employee
Employee
0 Kudos

Subscription to portal is mandatory to run the app.

You can launch standalone apps fro HTML5 Application menu, or from the terminal in BAS " cf html5-list -u - d

js2
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi yuval.morad - I am finding that I get this same oauth redirect error when I run the deployed app with the url provided by `cf html5-list -u - d`.

However if I configure a tile in the Launchpad service for this app it works fine.

js2
Product and Topic Expert
Product and Topic Expert
0 Kudos

Did you bind the destination in BAS (in the run configuration)? I found that if its not bound the app will not run at all inside BAS.

But for me - when I deploy it to CF I found that the app could not access the backend OData service. After tearing what little hair I have left out, I found that it only works when run from within the Launchpad or Portal. That does not specifically seem to be documented anywhere but I do believe the launchpad service prpovides the approuter for these "managed by sap" apps...

Murali_Shanmu
Active Contributor
0 Kudos

I am not sure why you are getting this error. I didnt have to manually create a service instance.

Here are the my project files.

mta-yaml.txt

xs-app-json.txt

Destinations

com-sap-uaa-empapp.txt

com-sap-uaa-empapp.txt

WouterLemaire
Active Contributor
0 Kudos

murali.shanmugham , it does work fine when deployed to the HTML5 App Repo. This error only shows up when running in BAS.

yuval_morad
Employee
Employee
0 Kudos

Please share

1. xsapp.json

2. manifest data source section

3. destination from cockpit

WouterLemaire
Active Contributor
0 Kudos

I'm not using any datasource. I just generated an empty UI5 app with authentication. I have the same on trial as on a productive landscape. On trial I don't see the HTML5 app in the Cloud Foundry menu...

Here you have my xs-app.json

{
  "welcomeFile": "/index.html",
  "authenticationMethod": "route",
  "logout": {
    "logoutEndpoint": "/do/logout"
  },
  "routes": [
    {
      "source": "^(.*)$",
      "target": "$1",
      "service": "html5-apps-repo-rt",
      "authenticationType": "xsuaa"
    }
  ]
}