<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Package @sap/cds for Node.js in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721071#M199680</link>
    <description>&lt;P&gt;Hi Ulysses,&lt;/P&gt;&lt;P&gt;I'm doing similar things in CF environment like you.&lt;/P&gt;&lt;P&gt;And I'm referencing below document.&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/a131984aefe94ff884e6b6819ee76bd9.html"&gt;SAP Cloud Application Programming Model - Javascript API&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I want to connect to the HANA DB at CF in my node.js module but I can't.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;const cds = require('@sap/cds');

// examples in the document
const srv = await cds.connect.to('db');
const { Books, Authors } = srv.entities('my.booskhop'); // undefined
const model = srv.model; // undefined&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Do you have any idea?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;JaeHyeon Lee.&lt;/P&gt;</description>
    <pubDate>Sat, 22 Dec 2018 04:06:32 GMT</pubDate>
    <dc:creator>former_member430679</dc:creator>
    <dc:date>2018-12-22T04:06:32Z</dc:date>
    <item>
      <title>Package @sap/cds for Node.js</title>
      <link>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaq-p/721068</link>
      <description>&lt;P&gt;Hello folks, &lt;/P&gt;
  &lt;P&gt;I'm building an app on Cloud Platform (CF) using Node.js/Express. This thing has a /db module containing a entity definition (books-model.cds) and /srv that runs a node.js app on server.js that should read data declared on db module. &lt;/P&gt;
  &lt;P&gt;According to &lt;A href="https://help.sap.com/viewer/4505d0bdaf4948449b7f7379d24d0f0d/2.0.03/en-US/54513272339246049bf438a03a8095e4.html" target="_blank"&gt;this documentation&lt;/A&gt; the package @sap/cds should help me do exactly that, using the statements below:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;cds.importEntities([
    { $entity: "xsds.test.cds::ds_test.e1" },
    { $entity: "xsds.test.cds::ds_test.e2",
      $fields: {
          a: { $association: "xsds.test.cds::ds_test.e2",
               $viaBacklink: "b" }
      }
    }
], callback);
function callback(error, entities) {
    var E1 = entities["xsds.test.cds::ds_test.e1"];
    var E2 = entities["xsds.test.cds::ds_test.e2"];
    // ...
}
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Thing is, @sap/cds module v2.10 doesn't seem to think that it is responsible for doing that. This version only handles the build and deployment of .cds files (to hdbcds et etc). &lt;/P&gt;
  &lt;P&gt;In a old version of this module, before going to npm repository, it was called "sap-cds" and it did provided this .importEntity method. &lt;/P&gt;
  &lt;P&gt;Does someone know what would be the equivalent of sap-cds on npm.sap.com, or even if it exists?&lt;/P&gt;
  &lt;P&gt;So far, I'm able to interact with the database using @sap/xsenv and @sap/hdbext.&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;import xsenv = require('@sap/xsenv') import hdbext = require('@sap/hdbext')    
const services = xsenv.getServices({ hana:'plcockpit-hdi' }) 

express.use('/', hdbext.middleware(services.hana))    
express.get('/', (req, res) =&amp;gt; {
        req.db.exec('SELECT * FROM \"com.acme::MyLibrary.Books\"', function (err, rows) {
            res.json({
                result: JSON.stringify(rows[0])
            })
        })
    })
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;(Code is a simplified version of the original)&lt;/P&gt;
  &lt;P&gt;Although it works, I would like to know if is there a more "high-level" api to interact with the CDS layer. &lt;/P&gt;
  &lt;P&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 11:37:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaq-p/721068</guid>
      <dc:creator>ulyssesbonfim</dc:creator>
      <dc:date>2018-11-12T11:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Package @sap/cds for Node.js</title>
      <link>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721069#M199678</link>
      <description>&lt;P&gt;Hi Ulysses, &lt;/P&gt;&lt;P&gt;have you solved the problem? I'm facing the same problem and basically i'm not able to use CDS api following the documenation.&lt;/P&gt;&lt;P&gt;Tks.&lt;/P&gt;&lt;P&gt;Daniele.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 11:11:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721069#M199678</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-12-17T11:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: Package @sap/cds for Node.js</title>
      <link>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721070#M199679</link>
      <description>&lt;P&gt;Hi Daniele, &lt;/P&gt;&lt;P&gt;No, the problem is still open. The workaround is to use @sap/xsenv and @sap/hdbext to read from DB directly. &lt;/P&gt;&lt;P&gt;I can't find an official tutorial on it, but you can find a sample code from &lt;A href="https://blogs.sap.com/2018/04/27/exploring-the-sap-hana-xs-advanced-secure-store-functionality-with-nodejs/"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Mon, 17 Dec 2018 12:41:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721070#M199679</guid>
      <dc:creator>ulyssesbonfim</dc:creator>
      <dc:date>2018-12-17T12:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Package @sap/cds for Node.js</title>
      <link>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721071#M199680</link>
      <description>&lt;P&gt;Hi Ulysses,&lt;/P&gt;&lt;P&gt;I'm doing similar things in CF environment like you.&lt;/P&gt;&lt;P&gt;And I'm referencing below document.&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/a131984aefe94ff884e6b6819ee76bd9.html"&gt;SAP Cloud Application Programming Model - Javascript API&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I want to connect to the HANA DB at CF in my node.js module but I can't.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;const cds = require('@sap/cds');

// examples in the document
const srv = await cds.connect.to('db');
const { Books, Authors } = srv.entities('my.booskhop'); // undefined
const model = srv.model; // undefined&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Do you have any idea?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;JaeHyeon Lee.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Dec 2018 04:06:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721071#M199680</guid>
      <dc:creator>former_member430679</dc:creator>
      <dc:date>2018-12-22T04:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Package @sap/cds for Node.js</title>
      <link>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721072#M199681</link>
      <description>&lt;P&gt;HI Ulysses,&lt;/P&gt;&lt;P&gt;Don't know if this helps.&lt;/P&gt;&lt;P&gt;I have followed the tutorial &lt;A href="https://developers.sap.com/tutorials/cp-apm-nodejs-create-service.html"&gt;https://developers.sap.com/tutorials/cp-apm-nodejs-create-service.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;After exposing and consuming OData from SQLite i have implemented the same scenario in hdb as well.&lt;/P&gt;&lt;P&gt;Everything that I did it was to change the package.json and then to run &lt;/P&gt;&lt;P&gt;cds deploy. &lt;/P&gt;&lt;P&gt;Because I used the SYSTEM user of the tenant, all tables were created under system schema ( please see below ).&lt;/P&gt;&lt;P&gt;I am still investigating/learning node &amp;amp;  @sap/cds modules so any piece of advice is very appreciated.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;package.json&lt;/P&gt;&lt;P&gt;{
  "name": "test1-hdb",
  "description": "Generated by cds init",
  "repository": "&amp;lt;Add your repository here&amp;gt;",
  "license": "ISC",
  "version": "1.0.0",
  "dependencies": {
    "@sap/cds": "^3.5.0",
    "express": "^4.16.4"
  },
  "engines": {
    "node": "&amp;gt;=8"
  },
  "cds": {
    "requires": {
      "db": {
        "kind": "hana",
        "model": "srv",
        "credentials": {
          "host": "xx.xxx.xxx.xxx",
          "port": 39041,
          "user": "SYSTEM",
          "password": "*****"
        }
      }
    }
  }
}&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/273616-hdb.jpg" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 18:37:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721072#M199681</guid>
      <dc:creator>Octav</dc:creator>
      <dc:date>2019-02-08T18:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Package @sap/cds for Node.js</title>
      <link>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721073#M199682</link>
      <description>&lt;P&gt;Hi Onu, &lt;/P&gt;&lt;P&gt;I'm not sure on what the question was, but it seems that you're troubled for tables on "SYSTEM" schema. &lt;/P&gt;&lt;P&gt;I think the idea would be to configure hdi-container on your mta.yaml (checkout &lt;A href="https://developers.sap.com/tutorials/xsa-hdi-module.html"&gt;https://developers.sap.com/tutorials/xsa-hdi-module.html &lt;/A&gt;Step 1: Create HDB Module). Once deployed it will generate a specific schema for your app. &lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;PS.: Your question albeit interesting is not directly related to the original. I would suggest create a new topic next time, so you gain more visibility and other people with more expertise can also shine some light &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Good luck in your journey&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 09:06:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721073#M199682</guid>
      <dc:creator>ulyssesbonfim</dc:creator>
      <dc:date>2019-02-11T09:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: Package @sap/cds for Node.js</title>
      <link>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721074#M199683</link>
      <description>&lt;P&gt;Hi Onu,&lt;/P&gt;&lt;P&gt;I am working on the same thing as you. When you work with HANA, you will probably want to use XSA with HDI concept. This means when you deploy your database part, an HDI container will be created. You then have to make sure, that your node.js module requires the database container. The cloud foundry environment will then inject the connection setting of the hdi container into your node.js module environment variables. This is standard cloud foundry development with XSA. You can then get the generated technical user und password for the container and use them in your above example. But...this does not solve the problem when deploying the application to the cloud platform.&lt;/P&gt;&lt;P&gt;How are we going to tell the cds to use the environment variables for the connection instead of the fixed values in the package.json? I am just trying to figure out how to fill the options parameter of the cds.connect function. If not parameters are given, is seems it will get them from the package.json.&lt;/P&gt;&lt;P&gt;Hope you could follow. &lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Tobi&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 13:26:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721074#M199683</guid>
      <dc:creator>tobias_mitter2</dc:creator>
      <dc:date>2019-02-13T13:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Package @sap/cds for Node.js</title>
      <link>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721075#M199684</link>
      <description>&lt;P&gt;Hello Tobias, &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;| How are we going to tell the cds to use the environment variables for the connection instead of the fixed values in the package.json?&lt;/P&gt;&lt;P&gt;The access to HDI container will be done via xsenv, like below (see my original post)&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;const xsenv = require("@sap/xsenv")

// Read container reference 
const services = xsenv.getServices({ hana:'mycontainer-hdi' }) 

// Use hana service middleware 
express.use('/', hdbext.middleware(services.hana)) &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This should provide your application the access to the right HDI container. &lt;/P&gt;&lt;P&gt;Hope this help you out &lt;/P&gt;</description>
      <pubDate>Tue, 19 Feb 2019 12:36:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721075#M199684</guid>
      <dc:creator>ulyssesbonfim</dc:creator>
      <dc:date>2019-02-19T12:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: Package @sap/cds for Node.js</title>
      <link>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721076#M199685</link>
      <description>&lt;P&gt;This might help someone.&lt;/P&gt;&lt;P&gt;I managed to get an express.js version of the cap to work by simple copying from node_modules @sap/cds/server.js. From there you can adapt to your needs. For instance, I added static additional content.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:09:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721076#M199685</guid>
      <dc:creator>martin_jonsson</dc:creator>
      <dc:date>2019-08-23T17:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Package @sap/cds for Node.js</title>
      <link>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721077#M199686</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have my project, using Node.js and CDS deployed on Cloud Floundry, developed using WebIDE, and I keep getting this error after trying to use the ORM inside the  "@sap/cds" package.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;sh: 1: node-pre-gyp: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! sqlite3@4.1.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the sqlite3@4.1.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vcap/.npm/_logs/2019-10-07T14_14_09_536Z-debug.log
       &amp;#27;[31;1m**ERROR**&amp;#27;[0m Unable to build dependencies: exit status 126
Failed to compile droplet: Failed to run all supply scripts: exit status 14
Exit status 223&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Oct 2019 14:54:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721077#M199686</guid>
      <dc:creator>former_member635061</dc:creator>
      <dc:date>2019-10-07T14:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: Package @sap/cds for Node.js</title>
      <link>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721078#M199687</link>
      <description>&lt;P&gt;Hi All and &lt;SPAN class="mention-scrubbed"&gt;stefanvoicila&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;I am also getting same error as Stefan.&lt;/P&gt;&lt;P&gt;Could anyone please help me to resolve the issue.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deep&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2020 20:33:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/package-sap-cds-for-node-js/qaa-p/721078#M199687</guid>
      <dc:creator>cloud_deep28</dc:creator>
      <dc:date>2020-06-04T20:33:53Z</dc:date>
    </item>
  </channel>
</rss>

