cancel
Showing results for 
Search instead for 
Did you mean: 

Encountering Primary Key Requirement in a CAP Project (@sap/cds v6.8 vs. v8)

EvaGil
Discoverer
781

Hi everyone,

I recently faced a challenge in my CAP project using Node.js. I defined some entities, and one of them lacked a primary key. When I ran mbt build, I encountered this error:

"This application uses @sap/cds version 6.8, which is not compatible with the installed @sap/cds-dk version 8. You can either:

  • Update @sap/cds to the latest version (recommended)
  • Downgrade @sap/cds-dk to version 7."

Following the recommendation, I upgraded @Sisn/cds to the latest stable version (8.0.3). However, after running mbt build again, I received a new error:

[ERROR] Expected entity to have a primary key (in entity: xxxx)

This behavior surprised me because I couldn't find any documentation explicitly mentioning mandatory primary keys for CAP projects, especially since it worked with previous @Sisn/cds versions. While I understand the importance of primary keys as good practice, I wanted to clarify if this requirement is officially documented and where to find updates on @Sisn/cds version changes.

If you've encountered a similar situation or have insights on primary key requirements in CAP projects, please share your thoughts in the comments below!

Thank you in advance!

 
View Entire Topic
Willem_Pardaens
Product and Topic Expert
Product and Topic Expert

You can find it here in the release notes of CDS 8: https://cap.cloud.sap/docs/releases/jun24#odata-entities-must-have-a-key

shiwanichawl
Associate
Associate
0 Kudos
This document is very helpful, i got same issue and resolved by moving it to warning messages