-1

I have an error on Chrome during the processing of a batch's response. I have tried on Firefox, Edge and Chromium and there is an error only on Chrome with the last version. On this Example I am using my own local OData server:

enter image description here

And here I am trying to read from https://services.odata.org/V2/OData/OData.svc/ enter image description here

After debugging I have identified where the difference is: https://openui5.hana.ondemand.com/resources/sap/ui/thirdparty/datajs.js

enter image description here

I have compared Chrome and Edge and I have noticed that the difference is on the header and how it's read. First you can see the attribue x.headers from Edge and under from Chrome. On Edge the header doesn't contain application/json. I have debugged and removed the rest on Chrome so it looks like Edge and it works then.

enter image description here

The BATCH it self looks like this:

--batchresponse_678d942c-694d-45a8-80ea-9174b251f69b
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 200 OK
Cache-Control: no-cache
DataServiceVersion: 2.0;
Content-Type: text/plain;charset=utf-8

3
--batchresponse_678d942c-694d-45a8-80ea-9174b251f69b
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 200 OK
Cache-Control: no-cache
DataServiceVersion: 1.0;
Content-Type: application/json;charset=utf-8

{
"d" : [
{
"__metadata": {
"uri": "https://services.odata.org/V2/OData/OData.svc/Categories(0)", "type": "ODataDemo.Category"
}, "ID": 0, "Name": "Food", "Products": {
"__deferred": {
"uri": "https://services.odata.org/V2/OData/OData.svc/Categories(0)/Products"
}
}
}, {
"__metadata": {
"uri": "https://services.odata.org/V2/OData/OData.svc/Categories(1)", "type": "ODataDemo.Category"
}, "ID": 1, "Name": "Beverages", "Products": {
"__deferred": {
"uri": "https://services.odata.org/V2/OData/OData.svc/Categories(1)/Products"
}
}
}, {
"__metadata": {
"uri": "https://services.odata.org/V2/OData/OData.svc/Categories(2)", "type": "ODataDemo.Category"
}, "ID": 2, "Name": "Electronics", "Products": {
"__deferred": {
"uri": "https://services.odata.org/V2/OData/OData.svc/Categories(2)/Products"
}
}
}
]
}
--batchresponse_678d942c-694d-45a8-80ea-9174b251f69b--

[UPDATE]

So, this is getting stranger. I just found out that in Chrome it works in Incognito mode but not on normal mode. I tried with Northwind and it's the same. It work's only on Incognito mode. I am using the latest version of UI5 from https://openui5.hana.ondemand.com/resources/sap-ui-core.js and I am using the template from https://github.com/SAP/openui5-masterdetail-app.

I am using Version 88.0.4324.150 of Chrome and I have also tried deleting the Cache

In openui5-masterdail-app I have only modified the oData service:

"uri": "https://cors-anywhere.herokuapp.com/https://services.odata.org/V2/OData/OData.svc/",

and

Master.view.xml

<List
                id="list"
                width="auto"
                class="sapFDynamicPageAlignContent"
                items="{
                    path: '/Suppliers'
                }"


<items>
                    <ObjectListItem
                    title="{Name}"
PeDeGa
  • 31
  • 5
  • Do you get the `$metadata` doc at all? As mentioned in https://stackoverflow.com/a/53878337/5846045, the proxy server `cors-anywhere.herokuapp.com` is strongly restricted now. With which IDE are you working? Locally with UI5 tooling? With SAP BAS? Web IDE? – Boghyon Hoffmann Feb 08 '21 at 22:18
  • Also the OData service `services.odata.org/V2/OData/OData.svc` is **not** V2 compliant. It doesn't have the `"results"` property which actually indicates that the service is very old and V1*-like* (`"results"` was first mandatory in OData V2). Same issue in this question https://stackoverflow.com/q/43661554/5846045 and in this GitHub issue: https://github.com/OData/ODataSamples/issues/119 – Boghyon Hoffmann Feb 08 '21 at 22:25
  • 1
    I think there are multiple factors leading to this issue in the question. I'd suggest to choose a different, a better maintained OData service (e.g. one of the [services from SAP ES5 system](https://blogs.sap.com/2017/12/05/new-sap-gateway-demo-system-available/)), and to avoid `cors-anywhere` but use documented guidelines as mentioned in https://stackoverflow.com/a/53878337/5846045 – Boghyon Hoffmann Feb 08 '21 at 22:28

1 Answers1

0

Just checking this possibility - Extensions.

Do you have any extensions (eg: like AdBlocker - Not saying Adblocker is the culprit.. but similar way of working), which may intercept the payload coming back?

To rule this out, do the following:

  • In chrome, create a new profile/account - without ANY extensions.
  • Switch to that account, and try running the app.
  • If it works, come back to your original account, and start disabling extensions one by one - to figure out which exactly may be the issue.

Again, I am not 100% sure, if extensions are the exact problem here - but I have had this as the problem in some of the apps I built. Hence, worth a try - especially the first step of creating a new profile without any extensions, and testing would be a quick one.

Best Regards, Gopal Nair.

Gopal Nair
  • 830
  • 4
  • 7
  • Hi Gopal, thanks for the tip. I will check it. I will also try to deploy in a server where I can have access from different PCs.As you said, it might lay on my Chrome – PeDeGa Feb 16 '21 at 12:15