Skip to Content
0
Jul 06, 2020 at 03:44 PM

Deployed CAP project cannot start: Specified entity xxx is not defined in the model srv/csn.json

617 Views Last edit Jul 06, 2020 at 06:12 PM 3 rev

  1. The application runs locally.
  2. `mbt build` seems to created this csn.json mentioned in the logs and put it under `./srv`.
  3. The original srv/external/SF_User.csn and the generated csn.json both contain an entity defintion for "SF_User.User"

Full log attached, but this is the error that is causing the cds run to quit:

2020-07-06T15:17:56.422+0000 [APP/PROC/WEB/0] ERR [ERROR] Invalid event handler registration for 'CREATE' 'SF_User.User' in 'userbrowser'.
2020-07-06T15:17:56.422+0000 [APP/PROC/WEB/0] ERR Specified entity 'SF_User.User' is not defined in the model 'srv/csn.json'.
2020-07-06T15:17:56.422+0000 [APP/PROC/WEB/0] ERR     at getNotInModelEntityError (/home/vcap/app/node_modules/@sap/cds-runtime/lib/cds-services/util/errors.js:35:10)
2020-07-06T15:17:56.422+0000 [APP/PROC/WEB/0] ERR     at On._entityParamValid (/home/vcap/app/node_modules/@sap/cds-runtime/lib/cds-services/services/hooks/Base.js:244:13)
2020-07-06T15:17:56.422+0000 [APP/PROC/WEB/0] ERR     at On._add (/home/vcap/app/node_modules/@sap/cds-runtime/lib/cds-services/services/hooks/Base.js:116:10)
2020-07-06T15:17:56.422+0000 [APP/PROC/WEB/0] ERR     at On.use (/home/vcap/app/node_modules/@sap/cds-runtime/lib/cds-services/services/hooks/Base.js:72:12)
2020-07-06T15:17:56.422+0000 [APP/PROC/WEB/0] ERR     at On.use (/home/vcap/app/node_modules/@sap/cds-runtime/lib/cds-services/services/hooks/Base.js:63:14)
2020-07-06T15:17:56.422+0000 [APP/PROC/WEB/0] ERR     at ApplicationService.on (/home/vcap/app/node_modules/@sap/cds-runtime/lib/cds-services/services/Service.js:511:23)
2020-07-06T15:17:56.422+0000 [APP/PROC/WEB/0] ERR     at ApplicationService.module.exports (/home/vcap/app/srv/service.js:39:9)
2020-07-06T15:17:56.429+0000 [APP/PROC/WEB/0] ERR npm ERR! code ELIFECYCLE
2020-07-06T15:17:56.429+0000 [APP/PROC/WEB/0] ERR npm ERR! errno 1
2020-07-06T15:17:56.451+0000 [APP/PROC/WEB/0] ERR npm ERR! userbrowser@1.0.0 start: `npx cds run`
2020-07-06T15:17:56.451+0000 [APP/PROC/WEB/0] ERR npm ERR! Exit status 1

I have attached the log files from CF.

Update: tried pushing manually with "CDS_ENV=production && cds build && cf push userbrowser-srv"

This results in a slightly different error (this time ... not defined in srv/service.cds):

   2020-07-06T20:02:59.05+0200 [APP/PROC/WEB/0] ERR { Error: Invalid event handler registration for 'CREATE' 'SF_User.User' in 'userbrowser'.
   2020-07-06T20:02:59.05+0200 [APP/PROC/WEB/0] ERR Specified entity 'SF_User.User' is not defined in the model 'srv/service.cds'.
   2020-07-06T20:02:59.05+0200 [APP/PROC/WEB/0] ERR     at getNotInModelEntityError (/home/vcap/app/node_modules/@sap/cds-runtime/lib/cds-services/util/errors.js:35:10)
   2020-07-06T20:02:59.05+0200 [APP/PROC/WEB/0] ERR     at On._entityParamValid (/home/vcap/app/node_modules/@sap/cds-runtime/lib/cds-services/services/hooks/Base.js:244:13)
   2020-07-06T20:02:59.05+0200 [APP/PROC/WEB/0] ERR     at On._add (/home/vcap/app/node_modules/@sap/cds-runtime/lib/cds-services/services/hooks/Base.js:116:10)
   2020-07-06T20:02:59.05+0200 [APP/PROC/WEB/0] ERR     at On.use (/home/vcap/app/node_modules/@sap/cds-runtime/lib/cds-services/services/hooks/Base.js:72:12)
   2020-07-06T20:02:59.05+0200 [APP/PROC/WEB/0] ERR     at On.use (/home/vcap/app/node_modules/@sap/cds-runtime/lib/cds-services/services/hooks/Base.js:63:14)
   2020-07-06T20:02:59.05+0200 [APP/PROC/WEB/0] ERR     at ApplicationService.on (/home/vcap/app/node_modules/@sap/cds-runtime/lib/cds-services/services/Service.js:511:23)
   2020-07-06T20:02:59.05+0200 [APP/PROC/WEB/0] ERR     at ApplicationService.module.exports (/home/vcap/app/srv/service.js:39:9) severity: 'Error' }
   2020-07-06T20:02:59.06+0200 [APP/PROC/WEB/0] ERR npm ERR! code ELIFECYCLE
   2020-07-06T20:02:59.06+0200 [APP/PROC/WEB/0] ERR npm ERR! errno 1
   2020-07-06T20:02:59.09+0200 [APP/PROC/WEB/0] ERR npm ERR! userbrowser@1.0.0 start: `npx cds run`
   2020-07-06T20:02:59.09+0200 [APP/PROC/WEB/0] ERR npm ERR! Exit status 1
   2020-07-06T20:02:59.09+0200 [APP/PROC/WEB/0] ERR npm ERR! 
   2020-07-06T20:02:59.09+0200 [APP/PROC/WEB/0] ERR npm ERR! Failed at the userbrowser@1.0.0 start script.
   2020-07-06T20:02:59.09+0200 [APP/PROC/WEB/0] ERR npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
   2020-07-06T20:02:59.09+0200 [APP/PROC/WEB/0] ERR npm ERR! A complete log of this run can be found in:
   2020-07-06T20:02:59.09+0200 [APP/PROC/WEB/0] ERR npm ERR!     /home/vcap/app/.npm/_logs/2020-07-06T18_02_59_091Z-debug.log