Skip to Content
0
Jan 17 at 03:38 PM

CDS Combined Backend (CAP Node.js) - Custom: TypeError: cds.connect(...).serve is not a function

244 Views

Dear community,

In our old project we used @sap/cds v3.x.x with @sap/cds-odata-v2-adapter-proxy using the implementation script of CDS Combined Backend (CAP Node.js) - Custom.

However when creating a new project with based on the new cds cli (v5.x.x) and adding the same index.js sample script as described on https://www.npmjs.com/package/@sap/cds-odata-v2-adapter-proxy it throws the error:

user: cap-test $ node srv/index
#2.0#2022 01 17 15:31:32:415#+00:00#WARNING#/LoggingLibrary################PLAIN##Dynamic log level switching not available#
[HPM] Proxy created: /  -> http://localhost:4004
[HPM] Proxy rewrite rule created: "^/v2" ~> ""
(node:548) UnhandledPromiseRejectionWarning: TypeError: cds.connect(...).serve is not a function
    at /home/user/projects/cap-test/srv/index.js:15:27
    at Object.<anonymous> (/home/user/projects/cap-test/srv/index.js:19:3)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47
(Use `node --trace-warnings ...` to show where the warning was created)
(node:548) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:548) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Is there an updated description available, or a version dependency for this to work ?

Thanks