cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP CAP: Error Starting Service After Deployment MODULE NOT FOUND requireStack

Cristian
Participant
0 Likes
449

Hi experts,

We have a CAP services that is using a set of custom .js files.

We are getting the error below after deployment when trying to start the service.

"error":{"code":"MODULE_NOT_FOUND","requireStack":["/home/vcap/app/srv/utils/xmlUtils.js","/home/vcap/app/srv/utils/validationHeader.js","/home/vcap/app/srv/controller/validationHeader.js","/home/vcap/app/srv/edi-code-to-order-srv.js"]}

Odd thing is that if we execute the service from BAS everything works fine but not able to deploy.

We have an event handler implemented named edi-code-to-order-srv.js for our edi-code-to-order-srv.cds. Here we have an import of a custom .js.

const cds = require('@sap/cds')
const { executeHttpRequest } = require('@sap-cloud-sdk/http-client')
const { validationHeaderControl } = require('./controller/validationHeader');

This custom .js has other requires of other custom .js and it is place within the srv folder.

Our package.json

{
  "name": "fof-edi-quote-to-order-njs",
  "version": "1.0.0",
  "description": "xxxxx",
  "repository": "xxxxxxx",
  "license": "UNLICENSED",
  "private": true,
  "dependencies": {
    "@cap-js-community/odata-v2-adapter": "^1.13.1",
    "@sap-cloud-sdk/http-client": "^3.16.0",
    "@sap-cloud-sdk/resilience": "^3.16.0",
    "@sap/cds": "^8",
    "@sap/cds-hana": "^2",
    "@sap/hana-client": "^2.21.28",
    "@sap/xssec": "^3",
    "express": "^4",
    "hdb": "^0.19.9",
    "axios": "^1.7.2",
    "body-parser": "^1.20.2",
    "dotenv": "^16.4.5",
    "fast-xml-parser": "^4.4.0",
    "fs": "^0.0.1-security",
    "he": "^1.2.0",
    "jsonwebtoken": "^9.0.2",
    "moment": "^2.30.1"
  },
  "devDependencies": {
    "@cap-js/sqlite": "^1",
    "@sap/cds-dk": "^7",
    "@sap/eslint-plugin-cds": "^3",
    "@sap/hdi-deploy": "4.9.5",
    "cds-swagger-ui-express": "^0.9.0",
    "eslint": "^9"
  },
  "scripts": {
    "start": "cds-serve"
  },
  "cds": {
    "requires": {
      "cpqApi": {
        "kind": "rest",
        "credentials": {
          "destination": "cpq-quote-api-i-http"
        }
      }
      "[production]": {
        "auth": "xsuaa"
      },
      "db": "hana"
    },
    "hana": {
      "deploy-format": "hdbtable"
    }
  }
}

Any idea what can be happenging?

Many thanks in advance!

C.

 

 

 

 

 

Accepted Solutions (0)

Answers (0)