cancel
Showing results for 
Search instead for 
Did you mean: 

Expected current segment '' to be '$count', '$ref', or a bound operation

jsancho
Participant
0 Kudos
2,030

Hi @all,

I'm just playing with CAP Node.js flavour and Fiori Elements when found that if in my project folder I have something to render in the APP folder even the simplest GET requests goes wrong.

{
    "error": {
        "code": null,
        "message": "Expected current segment '' to be '$count', '$ref', or a bound operation"
    }
}

and if I delete that folder all HTTP requests goes ok.

For sure I'm doing something wrong in the APP folder while playing with FioriElements but the thing is that I could understand having some error while rendering the FioriElement's app BUT, why having this problem with just a GET request?

Does anybody know why? I got stucked digging at the schemas and DB's part when the problem is not there 🙂

kammaje_cis
Active Contributor
0 Kudos

app module usually has the application router. (file xs-app.json). That might be faulty.

Accepted Solutions (1)

Accepted Solutions (1)

marcmaurí
Participant

Hi Jorge,

look at your requested url "http://localhost:4004/admin/Personas/"

You got the error because of the last "/" in the url. The correct one is "http://localhost:4004/admin/Personas"

Check these samples:

Hope this helps.

Best regards,

Answers (4)

Answers (4)

c-kobo
Advisor
Advisor
0 Kudos

Your app folder contains an index.cds which I assume is somehow influencing the service model. Not sure why you need an index.cds in the app folder, unless you use it for adding annotations.
Can you

1. With the app folder "active" open localhost:4004 in browser to see what entities are actuallybeing served and also check the $metadata

2. temporarily remove the index.cds, compare with 1. and see whether the error is still there?

jsancho
Participant
0 Kudos

Thnx Marc, but in this case that is not the problem. Here is the thing:

1. If I have this "app" folder so that CAP will try to serve my INDEX.HTML file instead the "by default" entry page, if I execute a simple GET request (even w/o the last "/" 😉 ) it returns the already mentinoned error.

2. BUT if I just rename the "app" folder, so that CAP understand that there's nothing "special" to serve but the "by default" entry page, in that case the GET request goes ok.

That's the thing that I don't understand, why having this "app" folder makes CAP to behave different to the same GET request?

Later on I'll check if the content of my "app" folder is correct (for sure it's not), but I assume that replying to a given GET request has to behave always the same, no matter if the "by default" entry page or a custom one has to be served. Isn't it?

jsancho
Participant
0 Kudos

Hi Nicolas,

with "something to render in your app folder" I'm want to say that I have an "app" folder with some JS files and an "index.html" file so that CAP could render this web instead of the "by default" one.

Regarding the GET request I'm trying to execute have a look at following screenshot.


If I have this "app" folder CAP returns HTTP 400 for the GET request, but if there's no "app" folder it handles correctly the GET request without any problem.

Why is that?

As I said, if there's something wrong in my "app" folder I could understand having errors while trying to render it but I didn't expect having this different behaviour with the GET request.

Thanks!!!! 😉

nicolas_lunet
Advisor
Advisor
0 Kudos

Hello and thanks for your question.

When you say that you have "something to render in your app folder", what do you mean exactly ?

And also could you give more details as to which GET request you are trying to do then ?

Nicolas