SAP / openui5

OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on almost any browser of your choice.
http://openui5.org
Apache License 2.0
2.96k stars 1.24k forks source link

Error: ui5loader-dbg.js:882 Uncaught Error: failed to load 'zprog/Component.js' from ./Component.js: 0 -' #2020

Closed anniew86 closed 6 years ago

anniew86 commented 6 years ago

OpenUI5 version: 1.54.xxx Browser/version (+device/version): Chrome v.62, PC Win7 32bit SP1

The programs based on CDN suddenly dumps with error: ui5loader-dbg.js:882 Uncaught Error: failed to load 'zprog/Component.js' from ./Component.js: 0 -'

I suppose it has something to do with new release 1.54 and async load of Component.js

If I change the bootstrap from: src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" to: src="https://openui5.hana.ondemand.com/1.52.11/resources/sap-ui-core.js"

the programs are running ok again.

stephania87 commented 6 years ago

Please check how modules are required in the application -https://openui5.hana.ondemand.com/#/topic/d12024e38385472a89c1ad204e1edb48 and if changing the settings does not work, post an example e.g. a zip file with the isolated code.

anniew86 commented 6 years ago

Here a zip with example. The program loads and works ok because of the fixed version 1.52.11 in the index.html. The error occures if insted of 1.52.11 the newest version is used. The program works with CDN so you have to do the settings in your browser because of Same-Origin-Policy.

ztest.zip

stephania87 commented 6 years ago

@anniew86 I changed the version in index.html to be src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" and ran the project as a Web Application without errors. By adding project settings you can run the project with FLP sandbox from WebIDE as well.

Please check if the issue is related to the structure of the project and the way resources are specified in the index.html or the project settings files.

anniew86 commented 6 years ago

Please do a try from local drive without http server, just browser & CDE, such way you can reproduce it very easy.

The version with 1.52.11 works ok.

The new version 1.54 dumps with following error:

ui5loader-dbg.js:882 Uncaught Error: failed to load 'ztest/Component.js' from ./Component.js: 0 - at makeNestedError (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:96:37) at requireModule (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:103:1858) at Object.requireSync (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:110:57) at n (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:663:7275) at Object.sap.ui.component (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:661:841) at f.e._createComponent (https://openui5.hana.ondemand.com/resources/sap/ui/core/ComponentContainer.js?eval:6:2493) at f.e.onBeforeRendering (https://openui5.hana.ondemand.com/resources/sap/ui/core/ComponentContainer.js?eval:6:2726) at f.a._handleEvent (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:982:373) at v (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:1115:1356) at R.renderControl (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:1115:2336) Caused by: Error: 0 - at a (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:99:88) at XMLHttpRequest. (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:99:307) at loadSyncXHR (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:99:401) at requireModule (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:103:1778) at Object.requireSync (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:110:57) at n (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:663:7275) at Object.sap.ui.component (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:661:841) at f.e._createComponent (https://openui5.hana.ondemand.com/resources/sap/ui/core/ComponentContainer.js?eval:6:2493) at f.e.onBeforeRendering (https://openui5.hana.ondemand.com/resources/sap/ui/core/ComponentContainer.js?eval:6:2726) at f.a._handleEvent (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:982:373)

codeworrior commented 6 years ago

UI5 does not support loading resources via the file:// protocol, an HttpServer is mandatory, as described in the documentation of the Development Environment, e.g. https://openui5.hana.ondemand.com/#/topic/b1fbe1a22f8d4a5bbb601591e27b68d1.html .

The documentation also describes several alternatives how to setup a dev environment.

codeworrior commented 6 years ago

We meanwhile learned that (some?) Cordova scenarios on iOS also rely on the file: protocol and stopped working with UI5 1.54 and higher.

Even though we still discourage the use of the file: protocol in general, not being able to run in a Cordova container would be too much of a restriction. We therefore analyzed the differences between 1.54 and 1.52 again and added a small fix (credits to @matz3) in all affect codelines that re-enables many file: scenarios:

The fix doesn't go beyond what jQuery.ajax does and browser specific security restrictions (e.g. the need to start Chrome with --allow-file-access-from-files) still apply. And we still suggest to use an HttpServer instead!

Last but not least, running your sample app in Chrome with --allow-file-access-from-files against https://openui5nightly.hana.ondemand.com/resources/sap-ui-core.js works again.