cds-dbm icon indicating copy to clipboard operation
cds-dbm copied to clipboard

Redeploying causes error (Cannot read properties of undefined (reading 'definitions')

Open ghost opened this issue 1 year ago • 1 comments

Hi,

I tried to redeploy a CAP app (which uses cds-dbm), that I already succesfully deployed some time ago. The content of the app didn't change, only the location of the repository and therefor I needed to setup CI/CD pipelines again.

When testing my release pipeline I then came across the following error thrown by the deploy_to_postgresql task:

[APP/TASK/deploy_to_postgresql/0] ERR TypeError: Cannot read properties of undefined (reading 'definitions')
[APP/TASK/deploy_to_postgresql/0] ERR at _newUpdate (/home/vcap/deps/1/node_modules/@sap/cds/libx/_runtime/common/utils/resolveView.js:335:38)
[APP/TASK/deploy_to_postgresql/0] ERR at _newQuery (/home/vcap/deps/1/node_modules/@sap/cds/libx/_runtime/common/utils/resolveView.js:632:42)
[APP/TASK/deploy_to_postgresql/0] ERR at resolveView (/home/vcap/deps/1/node_modules/@sap/cds/libx/_runtime/common/utils/resolveView.js:650:20)
[APP/TASK/deploy_to_postgresql/0] ERR at _plainUpdate (/home/vcap/deps/1/node_modules/@sap/cds/libx/_runtime/common/utils/cqn2cqn4sql.js:944:10)
[APP/TASK/deploy_to_postgresql/0] ERR at _convertUpdate (/home/vcap/deps/1/node_modules/@sap/cds/libx/_runtime/common/utils/cqn2cqn4sql.js:956:12)
[APP/TASK/deploy_to_postgresql/0] ERR at cqn2cqn4sql (/home/vcap/deps/1/node_modules/@sap/cds/libx/_runtime/common/utils/cqn2cqn4sql.js:998:12)
[APP/TASK/deploy_to_postgresql/0] ERR at PostgresDatabase.handler [as _rewrite] (/home/vcap/deps/1/node_modules/@sap/cds/libx/_runtime/db/generic/rewrite.js:29:15)
[APP/TASK/deploy_to_postgresql/0] ERR at PostgresDatabase.handle (/home/vcap/deps/1/node_modules/@sap/cds/lib/srv/srv-dispatch.js:59:53)
[APP/TASK/deploy_to_postgresql/0] ERR at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

My project uses @sap/[email protected], [email protected] and [email protected]

The deployer app that's generated by my mta.yaml (through mbt build) gets the following package.json: image

As there is no package-lock.json in the generated app, it causes the newest fitting versions to be installed for the deployer app when deploying, so I thought that might be an issue. However, when I install the newest versions of the 3 packages above and deploy to a local postgres (in docker) the deployment works without any errors with the exact same deploy command.

Can you support here? I'm a little bit lost as to what could be the issue.

Thanks & Best regards

ghost avatar Apr 17 '23 15:04 ghost

Additional Info regarding this issue:

The issue above only occurs with the following deploy command:

npx cds-dbm deploy --load-via delta --auto-undeploy

when switching to --load-via full the issue doesn't occur

Maybe this helps in analyzing the issue

ghost avatar May 09 '23 10:05 ghost