cancel
Showing results for 
Search instead for 
Did you mean: 

Update to CDS 5.6.1 - dumps cds run

Steven_UM
Contributor
0 Kudos

Hi,

I was having some issues with CQL and where statements and I noticed I was running in a slightly older version - 5.5.1 - so I decided to upgrade to the latest version 5.6.1.

Welcome in a world of pain ... when I run 'cds run' I am getting the following nice dump:

[INTERNAL ERROR] TypeError: Cannot read property 'items' of undefined
    at checkKeySpecViolations (/node_modules/@sap/cds-compiler/lib/edm/edmPreprocessor.js:1403:56)
    at /node_modules/@sap/cds-compiler/lib/edm/edmPreprocessor.js:1328:11
    at /node_modules/@sap/cds-compiler/lib/edm/edmUtils.js:67:11
    at Array.forEach (<anonymous>)
    at foreach (/node_modules/@sap/cds-compiler/lib/edm/edmUtils.js:62:44)
    at initializeEdmKeyRefPaths (/node_modules/@sap/cds-compiler/lib/edm/edmPreprocessor.js:1311:7)
    at /node_modules/@sap/cds-compiler/lib/model/csnUtils.js:690:30
    at Array.forEach (<anonymous>)
    at cb (/node_modules/@sap/cds-compiler/lib/model/csnUtils.js:690:16)
    at forEachGeneric (/node_modules/@sap/cds-compiler/lib/model/csnUtils.js:686:5)

With the debugger I think I pinpointed it to the following entity which is causing this dump

entity AnalyticsConversationsMonths as select from AnalyticsConversationsDateBase {
  key period,
  sum(conversations) as conversations,
  sum(users) as users
} group by period
  order by period desc;

This all worked nicely ofcourse in the previous version.

Anybody having any suggestions ?

Thanks,

Steven

Accepted Solutions (0)

Answers (2)

Answers (2)

hjb
Advisor
Advisor
0 Kudos

We have released compiler 2.10.4 fixing this dump. Please upgrade.

hjb
Advisor
Advisor
0 Kudos

Thanks for reporting this dump.

I can recreate the error when using an untyped select item as key:

entity A { key id: Integer; };
service S {
  entity AP as projection on A { key id, sum(id) as sums };
  entity APP as projection on AP { key sums };
};

All keys must have a type, if you're using expressions make sure you type cast them.

Correct example would be:

service S {
  entity AP as projection on A { key id, sum(id) as sums : Integer };
  entity APP as projection on AP { key sums };
};

We'll fix it.

Steven_UM
Contributor
0 Kudos

Thanks for your fast response hans-joachim.both

My field 'period' is indeed not typed either - somehow I assumed using functions would auto type them - eg 'to_date' one would assume it gets the type 'Date'.

key to_date(concat(concat(concat(year(start), '-'), month(start)), '-01'), 'YYYY-MM-DD') as period,

And thus same for my sum(xx).

Will change and recheck - on a side note for that - I just downgraded back to a prev cds version - this was the first time for me doing that and I found it quite a pain. I used 'npm uninstall' to remove the global packages and then 'npm install cds-dk' with a specific package version but that would still install the latest cds version. Finaly I had to reverse changes in package and package-lock back to my older versions, remove all sap folders in my project nodejs folder and remove globally. Then it worked by using the install with specific version.

Prob my inexperience with npm but any suggestions on how to 'easily' switch CDS versions in a project ?

Thanks,

Steven

BTW ... if you would have time - could you have a look at another puzzling thing I asked a couple of days ago?

Compositions and CQL in Node.JS