question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Server will crash when query with filter like: $filter=false and age ge 12

See original GitHub issue

entity:

entity Foo : managed {
  key ID: UUID;
  startTime: DateTime;
  name: String;
  age: Integer;
}

service:

service TestService {
   entity Foo as projection on my.Foo;
}

query:

http://localhost:4004/test/Foo?$filter=false http://localhost:4004/test/Foo?$filter=age ge 12 http://localhost:4004/test/Foo?$filter=false or age ge 12 query 1 and 2 are right, but 3 with error:

[INTERNAL ERROR] TypeError: left is not iterable
at ExpressionToCQN._binary (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/adapter/odata-v4/odata-to-cqn/ExpressionToCQN.js:259:25)
at ExpressionToCQN.parse (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/adapter/odata-v4/odata-to-cqn/ExpressionToCQN.js:294:21)
at _filter (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/adapter/odata-v4/odata-to-cqn/readToCQN.js:42:50)
at readToCQN (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/adapter/odata-v4/odata-to-cqn/readToCQN.js:243:5)
at odataToCQN (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/adapter/odata-v4/odata-to-cqn/odataToCQN.js:24:14)
at OdataContext.get (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/adapter/odata-v4/utils/OdataContext.js:265:23)
at Object.context [as handler] (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/services/handlers/onRead.js:13:15)
at next (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/services/hooks/On.js:185:37)
at On._middleware (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/services/hooks/On.js:214:5)
at Promise (/node/v10.19.0/lib/node_modules/@sap/cds-dk/node_modules/@sap/cds-services/lib/services/hooks/On.js:84:12)
Please report this error.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
fourmatrixcommented, Apr 24, 2020

Hi David,

I don’t think $filter=false or age ge 12 make any sense, just found some coding in UI5 will create this query filter, maybe it’s a bug, but it leads to crash, if it’s invalid and we don’t support this kind of filter, an exception or error would be better, the user will know that there are bugs in his coding.

Best regards

0reactions
David-Kunzcommented, May 5, 2020

Hi @Vest,

Yes that’s true, but it doesn’t make any sense to send such requests.

Anyway, we will support those filters in the newest version of @sap/cds.

Best regards, David

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Node server ungracefully crashes when given ... - GitHub
When a server request contains a query param which contains a single double quote ( " ), the server will crash with a...
Read more >
SQL Server 2016 Query Crashes Server - DBA Stack Exchange
@Dave I ran the repro and able to crash SQL. But with query hint SELECT DISTINCT HASHBYTES('md5', VarCharMAX) FROM dbo.Testing option (maxdop 1) ......
Read more >
aDFS: An Almost Depth-First-Search Distributed Graph ...
In graph queries, isomorphic matching and automorphism elimination can be simulated with filters and/or with query specifiers, such as GROUP BY.
Read more >
Here are 7 reasons for why databases will crash and why you ...
4. HARDWARE AND SOFTWARE FAILURES – A host server hardware or power failure can crash your database server to stop very suddenly. It...
Read more >
220444 – x11-servers/xorg-server crashes on attempt to play ...
VAAPI also supports encoding but I can only confirm it works on i965 + drm-next. > Should Firefox be able to use vdpau...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found