Skip to Content
1
Aug 27, 2020 at 01:01 PM

@sap/cds ^4: Entity is annotated with "@sap.persistence.skip" and cannot be served generically

878 Views

Hi CAP experts,

after upgrading to @sap/cds to 4.1.7, I get the following error when the app is deployed to Cloud Foundry (works fine when running locally):

<error xmlns="http://docs.oasis-open.org/odata/ns/metadata">
    <code>501</code>
    <message>Entity "xx.yy.MobileService.CheckUser" is annotated with "@sap.persistence.skip" and cannot be served generically.</message>
    <annotation term="Common.numericSeverity" type="Edm.Decimal">4</annotation>
</error>

It is working fine on a subaccount with @sap/cds 3.34.3.

I have reviewed the release notes and cannot find any applicable changes.

Your environment (run the following commands):

  • cds -v
@sap/audit-logging: 3.1.1
@sap/cds: 4.1.7
@sap/cds-compiler: 1.35.0
@sap/cds-dk: 2.0.8
@sap/cds-foss: 2.0.0
@sap/cds-odata-v2-adapter-proxy: 1.4.42
@sap/cds-reflect: 2.12.2
@sap/cds-runtime: 2.1.7
@sap/cloud-sdk-vdm-business-partner-service: 1.20.0
@sap/cloud-sdk-vdm-sales-order-service: 1.20.0
@sap/hana-client: 2.5.105
@sap/xssec: 3.0.9
@seidor/s4notifications: 1.0.0
Node.js: v10.16.3
home: C:\Users\mmauri\ipWorkspace\s4notifications\node_modules\@sap\cds
  • node -v
v10.16.3
  • java -version (if applicable)

Steps to reproduce:

  • deploy the app to cloud foundry (works fine when running locally)
  • run https://yourapproute/mobile/CheckUser in a browser

Additional information (if applicable):

  • service.cds
service MobileService {
    @cds.persistence.skip
    entity CheckUser {
        key username   : String;
        is_admin: Boolean;
        is_user: Boolean;
        is_dummy: Boolean;
        has_admin_user: Boolean;
        has_admin_dummy: Boolean;
        has_user_dummy: Boolean;
        token: String;
        tenant: String;
    }
  • service.js
srv.on('READ', 'CheckUser', common.readFunction)
  • common.js
    readFunction : async function (req) {
      const users = [
          {
              username: req.user.id,
              is_admin: req.user.is("admin"),
              is_user: req.user.is("user"),
              is_dummy: req.user.is("dummy"),
              has_admin_user:  req.user.is(["admin", "user"]),  
              has_admin_dummy: req.user.is(["admin", "dummy"]),
              has_user_dummy: req.user.is(["user", "dummy"]),
              tenant: req.user.tenant
          }
      ]
      return users;
    },

Thanks in advance.

Best regards,

Marc