Skip to Content
0
Apr 09, 2020 at 06:30 PM

Fetch Javascript API doesn't work on SCP Portal

233 Views Last edit Apr 20, 2020 at 08:42 PM 2 rev

I have created a SAP UI5 App on my SCP Neo Trial Account and then I deployed this application to SAP Cloud Platform on HTML5 Application.

It works well on Web IDE and also works perfectly fine if I open the link that HTML5 Application have generated for me.

But when I put this same application into SCP Portal, the application still opens up, but all my Javascript Fetch calls does not work anymore.

Does SCP Portal not support fetch, or we need to set up something else?

Edit: Here's more info...

Fetch request:

fetch("/database/public/tests/xsjs/getDate.xsjs")
  .then(function(response) {
    return response.json();
  })
  .then(function(json1) {
    view.setModel(new JSONModel({text: json1.nowDate}), "XSJS");
  });

new JSONModel("/database/public/tests/xsjs/getDate.xsjs")
  .attachRequestCompleted({}, function(param) {
    view.setModel(new JSONModel({text: param.getSource().getData().nowDate}), "JSONMODEL");
  });

neo-app.json: (that's the only snippet where I refer to the destination)

{
  "path": "/database",
  "target": {
    "type": "destination",
    "name": "database"
  }
}

destination:

This is what I got when running the deployed HTML5 application to SAP Cloud Platform:

This is what I got when running this same deployed app, but in SCP Portal:

(The text under yellow is just a hardcoded string, that I put on page while the fetch request doesn't retrieve my response)

That's the error that I'm getting:

(I don't know why Portal is changing my URL request and pre fixing https://flpportal-p2001664935trial)

Attachments

destination.png (34.8 kB)
html5.png (11.7 kB)
portal.png (19.8 kB)
error.png (100.6 kB)