Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPM Run Load Error: Model not found #5

Closed
thymdi opened this issue Apr 29, 2022 · 7 comments
Closed

NPM Run Load Error: Model not found #5

thymdi opened this issue Apr 29, 2022 · 7 comments
Assignees

Comments

@thymdi
Copy link

thymdi commented Apr 29, 2022

convertData.js file errors as model path '/gen/srv/srv/csn.json' doesn't exist

@jung-thomas
Copy link
Contributor

Have you ran a cds build command first? That should create the /gen/ folder and output the csn model.

@thymdi
Copy link
Author

thymdi commented Apr 29, 2022

I see the model path after cds build but with cds deploy --to hana the /gen/ folder is re-created and csn.json is moved to gen/db/last-dev.

Also, loading the data gives a load of errors of two types:
CompileMessage {
message: 'CSN property ‘on’ can only be used alternatively to ‘keys’',
location: [Object],
'$location': [Object],
validNames: null,
severity: 'Error'

and

CompileMessage {
message: 'CSN property ‘mixin’ is not expected in ‘projection’',
location: [Object],
'$location': [Object],
validNames: null,
severity: 'Error'

@jung-thomas
Copy link
Contributor

jung-thomas commented Apr 29, 2022

I see the model path after cds build but with cds deploy --to hana the /gen/ folder is re-created and csn.json is moved to gen/db/last-dev.

Interesting - it does that for me now as well. It seems like another cds build is needed after the cds deploy. I'm not sure why the deploy is doing that though. Perhaps a recent change to the way deploy works or a bug. But it does seem like just running another cds build afterwards restores the full /gen folder.

Although I don't receive any of the errors you reported when running the load script. Here is my output when I ran it just now:
image

Perhaps you can post a screenshot to get a sense of where those errors might be coming from. Also try running cds version from the same place you run the load script. Maybe you are picking up an older, global install of CDS. Especially the mixin not expected in the projection sounds like maybe an older release. I just tested against the latest available cds version.
image

@jung-thomas jung-thomas self-assigned this Apr 29, 2022
@thymdi
Copy link
Author

thymdi commented Apr 29, 2022

When loaded the data using the restored /gen/ folder (after second build), got no errors.
Still getting the errors if I load with /gen/db/last-dev model.
The two generated csn.json files have some differences.

@jung-thomas
Copy link
Contributor

Yes, I'm not sure why the srv content within /gen is getting wiped out by the deploy. Seems to be not right to me. But that csn in the /gen/db/last-dev is something different. It's how cds is just keep track of the changes that have been made to any part of the data model that uses persistence journaling/Schema Evolution.

@cds.persistence.journal
- this causes the creation of hdbmigrationtable instead of regular hdbtable. https://blogs.sap.com/2022/02/15/sap-cap-recent-enhancements-the-hana-dev-should-know-about/
But this isn't the complete model, it's only a partial model used internally within CAP to track changes.

For the data load or any other usage of the CAP APIs you want the full model that should be in the /gen service folder. So, the whole role problem here seems to be that /gen/srv is getting deleted for some reason when the cds deploy runs. But at least there is an easy work around to just run cds build again after a deploy to bring it back.

@thymdi
Copy link
Author

thymdi commented Apr 29, 2022

Ok, I see. Thanks for explaining.

@jung-thomas
Copy link
Contributor

I did add two notes to the README.md about this situation and I'll enter an internal ticket to try and see if we can figure out why the /gen/srv is getting cleared in the first place.
Thanks,
Thomas Jung

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants