SAP / ui5-tooling

An open and modular toolchain to develop state of the art applications based on the UI5 framework
https://sap.github.io/ui5-tooling
Apache License 2.0
466 stars 71 forks source link

Unable to load load OData metadata with UI5 CLI v4 and SAPUI5 1.71 #988

Open marianfoo opened 3 months ago

marianfoo commented 3 months ago

Expected Behavior

Starting Fiori elements App with Fiori Tooling and UI5 CLI v4 and SAPUI5 Version 1.71

Current Behavior

Unable to load metadata from OData Service provided by CAP

image

Steps to Reproduce the Issue

  1. git clone https://github.com/marianfoo/ui5cliv4-v71
  2. cd ui5cliv4-v71
  3. npm i
  4. npm start

It works with either UI5 CLI v3 and SAPUI5 1.71 or with UI5 CLI v4 and SAPUI5 1.84 or above.

It did work with a freshly generated Fiori elements application, but i can´t tell what the difference was to make it work.

Context

Log Output / Stack Trace

➜  ui5cliv4-test-71 git:(main) ✗ npm start              

> ordersv2fenondraft71@0.0.1 start
> fiori run -p 8080 --open "index.html?sap-ui-xx-viewCache=false&sap-language=EN"

info fiori-tools-proxy Using UI5 version 1.71.67 based on manifest.json
info fiori-tools-proxy Starting fiori-tools-proxy using following configuration:
info fiori-tools-proxy proxy: 'undefined'
info fiori-tools-proxy ignoreCertError: 'false'
info fiori-tools-proxy backend: [{"path":"/odata/v2/orders","url":"https://livedemo.spreadsheet-importer.com"}]
info fiori-tools-proxy ui5: [{"path":"/resources","url":"https://ui5.sap.com","version":"1.71.67"},{"path":"/test-resources","url":"https://ui5.sap.com","version":"1.71.67"}]
info fiori-tools-proxy debug: 'false'
info backend-proxy-middleware Backend proxy created for https://livedemo.spreadsheet-importer.com /odata/v2/orders
info fiori-tools-appreload Livereload middleware started for port 35732 and path /Users/marianzeis/DEV/ui5cliv4-test-71/webapp
info fiori-tools-preview Initialized for app ui.v2.ordersv2fenondraft
Server started
URL: http://localhost:8080
info backend-proxy-middleware /odata/v2/orders/$metadata?sap-value-list=none&sap-language=EN
codeworrior commented 3 months ago

This is caused by a mismatch of your manifest version wrt. the UI5 version.

The UI5 tooling 4.0 enhances the manifest, json with information about the supportedLocales. But in UI5 1.71, this was not supported yet. The tooling uses the manifest's _version property to decide whether the supportedLocales can be generated or not. Your manifest has version 1.48 which is only supported since UI5 1.108.

When I reduce the version to 1.17 (which was the manifest version supported by UI5 1.71), then the app starts again.

codeworrior commented 3 months ago

You can find the mapping between manifest versions and UI5 versions here

marianfoo commented 3 months ago

Thank you @codeworrior for the quick explanation. But shouldn't there be a 'warn' or something to indicate that you can do the adjustment yourself? I had already suspected the manifest as the cause of the error, but I would not have found the loading of the metadata that was the cause right away in a more complicated app.

codeworrior commented 3 months ago

I just said to @randombyte that I would expect this as the next question :-)

Sure, a warning would be nice. For some historic reasons, the runtime does not check the manifest version, but that would be one option. For the tooling, it can be rather difficult to know what version is used at runtime (e.g .when not the local server is used). But the (invalid) combination of _version and minUI5Version in the Manifest could be detected, maybe that's an option.

We'll discuss this internally.

codeworrior commented 3 months ago

BTW: thank's for the fast and easy to reproduce feedback reg. tooling 4.0 :-)

marianfoo commented 3 months ago

BTW: thank's for the fast and easy to reproduce feedback reg. tooling 4.0 :-)

You´re welcome, the investment in my CI Pipeline pays off

I just said to @RandomByte that I would expect this as the next question :-)

Then I'll ask the right questions :)

In the UI5 development there are enough errors anyway that you have to interpret correctly, it would be nice if this can be checked as well as possible so that you can solve it yourself.

You can either close this if you create a new issue or leave it open as reference, up to you

NAVI-91 commented 1 month ago

Hello,

I have a same issue after trying to run new fresh app. I create project by using reentranceTicket authentication. Metadata is not loaded, browser says "file NOT found"

image

Odata service works fine on browser.

image

image

RandomByte commented 1 month ago

@NAVI-91 based on your description, I don't think this is the same issue. Please raise a dedicated issue or SAP support incident

The issue discussed in this incident has been documented here: https://sap.github.io/ui5-tooling/stable/updates/migrate-v4/#app-stops-working-with-ui5-171