sapmentors / cap-community

SAP CAP Community
MIT License
97 stars 26 forks source link

Odata V2 adapter for CAP service #68

Closed shyamkumarc closed 4 years ago

shyamkumarc commented 4 years ago

When i try to use Odata V2 adapter( github.com/gregorwolf/SAP-NPM-API-collection/tree/master/apis/cds-odata-v2-adapter-proxy ) , the V2 link gives an internal server error response. I chose the "CDS combined backend (Node.js) - custom" for my use case - when i run index.js , it works fine for V4 , but for the V2 path it gives internal server error. A look at the log for the service shows an error as follows: "Error: CDS compilation failed\ncat-service.cds:1:40-58: Error: Cannot find local module '../db/data-model' .

I'm sharing a Github link to my sample project here : https://github.com/shyamkumarc/CAP_POC

Please guide.

gregorwolf commented 4 years ago

Please adjust your project to use the generated csn.json as I did in v2server.js#L9. At runtime in CF cds doesn't have access to the db folder that contains the DB schema. So you have to point the proxy to a static resource that is available in srv.

shyamkumarc commented 4 years ago

Thanks a Lot @gregorwolf ! it worked 👍