cancel
Showing results for 
Search instead for 
Did you mean: 

Error while loading ES5-OData Service in Fiori App

0 Kudos
530

Tutorials: https://developers.sap.com/tutorials/appstudio-fioriapps-create.html
--------------------------
Hey guys,

I did the tutorial on creating an Fiori Freestyle App with BAS and ES5 OData-Serivce and I did everything like described in the tutorial, but when I start the App and open it in a new Tab The App can not load the data from the Es5 OData-Service because the browser blocks the load of the metadata due to cors-policy.

Any hints what I might have forgotten?

Error in Console:

Access to XMLHttpRequest at 'https://sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC/$metadata?sap-language=DE' (redirected from 'https://workspaces-ws-8bb28-app1.eu10.trial.applicationstudio.cloud.sap/nsBusinessPartners/sap/opu/odata/iwbep/GWSAMPLE_BASIC/$metadata?sap-language=DE') from origin 'https://workspaces-ws-8bb28-app1.eu10.trial.applicationstudio.cloud.sap' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Log-dbg.js:456 2021-03-02 12:05:57.709054 [ODataMetadata] initial loading of metadata failed - 
f @ Log-dbg.js:456
Log-dbg.js:456 2021-03-02 12:05:57.709129 Error: HTTP request failed - 
f @ Log-dbg.js:456
sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC/$metadata?sap-language=DE:1 

Problems in BAS Debug Console:

#2.0#2021 03 02 11:05:35:779#+00:00#INFO#/approuter#####klrwndag##########klrwndag#PLAIN##Application router is listening on port: 6004#
#2.0#2021 03 02 11:05:55:908#+00:00#INFO#/Auth/OAuth2#####3316d19b-d86f-42e3-a6c4-5e4013366bb4####zNPz3mUir7BjHW4nZuIR2OGVbujGxXO4######3316d19b-d86f-42e3-a6c4-5e4013366bb4#PLAIN##req.url: /nsBusinessPartners/index.html#
#2.0#2021 03 02 11:05:55:910#+00:00#INFO#/Auth/OAuth2#####3316d19b-d86f-42e3-a6c4-5e4013366bb4####zNPz3mUir7BjHW4nZuIR2OGVbujGxXO4######3316d19b-d86f-42e3-a6c4-5e4013366bb4#PLAIN##sending page with client-side redirect to https://54f34bdetrial.authentication.eu10.hana.ondemand.com/oauth/authorize?response_type=code&clien...
#2.0#2021 03 02 11:05:55:912#+00:00#INFO#/Auth/OAuth2#####3316d19b-d86f-42e3-a6c4-5e4013366bb4####zNPz3mUir7BjHW4nZuIR2OGVbujGxXO4######3316d19b-d86f-42e3-a6c4-5e4013366bb4#PLAIN##x-forwarded-path header: undefined#
Application 'login' not found in local html5-apps-repo and there is no binding to remote html5-apps-repo (x-correlationid: undefined)

Accepted Solutions (0)

Answers (1)

Answers (1)

gregorw
Active Contributor

Have you configured the destination as described in the prerequisites?

0 Kudos

Hey Gregor,

yes i followed the exact instructions as you can see here:

In the wizzard I can see all the services from the es5 backend. Its only when I open the app after creating a run configuration.

Can it be that I used the deprecated Fiori Freestyle Wizzard? I also tried to use Abap as landscape option but I got the same CORS error.

gregorw
Active Contributor
0 Kudos

Please check your manifest.json file if the absolute URL was used in the data source definition.

0 Kudos

Hey Gregor,

this is the data source definition:

Best Regards,

Dominik

RazK
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi domae-swm ,

I think gregorw refers to the destination configuration in SAP BTP cockpit. There's a tutorial on how to create it.

Regards - Raz

0 Kudos

Hi Raz Korn,

but I already answered to the destination question as you can see above. The next was about the data source definition in the manifest.json, and I think you mean the manifest.json from the UI5 App right? @ gregorw

Best Regards

RazK
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi dominik.espitalier ,

I pushed the project to git. It is working well for me.

If it does not work for you, then there's probably a specific setup issue that needs to be resolved.

Regards - Raz