Skip to Content

@sap/cds-odata-v2-adapter-proxy deployed to CF

Dear CAP Experts,

I've created a sample CAP application bookshop_odatav2 based on the bookshop scenario. After some adaptations, the application has been deployed successfully to Cloud Foundry and works as expected.

Then I added the @sap/cds-odata-v2-adapter-proxy as indicated in the package readme file:

### CDS combined backend (Node.js) - integrated
In your existing `@sap/cds` project:
- Run `npm install @sap/cds-odata-v2-adapter-proxy -s`

- Create new file `server.js` in the service folder `srv` of your project: `./srv/server.js`

"use strict"; 
const cds = require("@sap/cds");
const proxy = require("@sap/cds-odata-v2-adapter-proxy");
cds.on("bootstrap", app => app.use(proxy()));
module.exports = cds.server;

That works fine when running locally, so http://localhost:4004/catalog/Authors produces an OData v4 output and http://localhost:4004/v2/catalog/Authors a v2 output, but doesn't work after deploying it to Cloud Foundry, cause the output is always in OData v4.

Is there anything else to do to deploy the app an get a v2 output when running on cloud foundry?

Thanks in advance.

Best regards,


Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Mar 30 at 04:54 PM

    Please check out how I start the V2 proxy in my bookshop-demo project.

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Gregor,

      thanks four your input. I get the same error than in the topic mentioned above. The problem was solved there by switching to a different version of cds and the v2 proxy. I just updated all the dependencies to the current version and still get the error. My config:

      @sap/cds: 3.34.1
      @sap/cds-compiler: 1.26.2
      @sap/cds-dk: 1.8.2       
      @sap/cds-foss: 1.2.0
      @sap/cds-odata-v2-adapter-proxy: 1.4.30
      @sap/cds-reflect: 2.11.0
      @sap/cds-runtime: 1.1.1
      Node.js: v12.14.0

      I will try with diffenret versions and open an issue.

      Best Regards,


Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.