SAP Knowledge Base Article - Preview

3798433 - CAP CDS Upgrade – "Primary Key Is Not Defined" / "Expected Entity to Have a Primary Key" Error During MTAR Deployment

Symptom

  • After upgrading the @sap/cds version, deploying an MTAR fails with an error such as:
    • "primary key is not defined"
    • "Expected entity to have a primary key"
  • Attempting to define a key from existing fields results in duplicate data entry or cannot be null errors
  • Using cuid() as a generated key results in empty/null field cannot be a primary key errors


Read more...

Environment

  • SAP BTP Cloud Foundry
  • SAP CAP (Node.js or Java)

Product

SAP Business Application Studio all versions

Keywords

CAP, CDS, CAPM, MTA, MTAR, deploy, deployment, primary key, entity key,odata-spec-violation-no-key, Expected entity to have a primary key, primary key is not defined, cuid, UUID, CDS upgrade, @sap/cds, OData, BTP, Cloud Foundry, CDS build, cdsc, severities, Warning, duplicate key, cannot be null, null primary key, CDS compiler , KBA , BC-XS-CDX-COR , SAP CAP– Compiler and CDS language , Problem

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.