cancel
Showing results for 
Search instead for 
Did you mean: 

ProvisioningService / cds.mtx.in

0 Kudos

Dear colleagues,

I try to setup a very basic multitenancy mta skeleton using the cds-mtx. After reading a while through various sources I came up with two pillars that have to be done:

cds.on('bootstrap', async (app) => { 
    await cds.mtx.in(app);
    const provisioning = await cds.connect.to('Provisioning');
    provisioning.impl(require('./provisioning')); 
});

None of those two steps works for me, though. For the cds.mtx.in I get the error message

TypeError: cds.mtx.in is not a function

and for the Provisioning I get

Didn't find a configuration for 'cds.requires.Provisioning'<br>

I followed the instructions I found around the CAP documentation and in various places in github.com / github.wdf.sap.corp. I did not find a documentation though that helped me over that cliff.

The repo containing the code is CAP PoC, branch main. As it is you can run cds watch and use the test.http file to do the test calls. Then you can uncomment one by one the offending lines in server.js (line 27 for mtx and lines 28/29 for the Provisioning thing) to see the error.

I'm not used to Javascript, so this might be indeed just a plain beginners error.

Does anybody have a hint for me?

Thanks

Mathias

david_kunz2
Advisor
Advisor
0 Kudos

Hi Mathias,

Did you install all the required libraries in your package.json? (I don't have access to your repo, so I cannot look). They are listed here: https://cap.cloud.sap/docs/guides/multitenancy#nodejs-stack

Best regards,
David

0 Kudos

Hi David,

indeed I have, even more, just different versions meanwhile...

"@sap/cds": "5.1.5",

"@sap/cds-compiler": "2.2.8",

"@sap/cds-mtx": "^2",

"@sap/hana-client": "^2.6",

"@sap/hdi-deploy": "4.0.5",

"@sap/instance-manager": "^2",

"@sap/logging": "^6",

"@sap/xssec": "^3",

"express": "^4",

"passport": "^0.4"

Sorry, the repo was still hiddn, it's public now if you want to have a second look.

Thanks

Mathias

steffenwaldmann
Advisor
Advisor
0 Kudos

Hi Mathias,

I can't find @sap/cds-mtx in your package.json. Can you update your repository to reflect the latest changes?

Best regards,

Steffen

0 Kudos

Hi Steffen,

yes, it's in the mta branch - the main branch does not have it yet.

May be I should just merge...

Thanks for your time

Mathias

Accepted Solutions (0)

Answers (1)

Answers (1)

steffenwaldmann
Advisor
Advisor
0 Kudos

Hi Mathias,

In your .cdsrc.json, please replace "multiTenancy" by "multitenancy" and also add it to the non-production profile "requires" section.

Here's a minimal example:

"cds": {
  "requires": {
    "db": {
      "kind": "hana",
      "model": ["db", "srv"],
      "vcap": {"label": "service-manager"}
    },
    "uaa": {
      "kind": "xsuaa"
    },
    "multitenancy": true
  }
}

Best regards,

Steffen

0 Kudos

Hi Steffen,

yep, step forward, it gets loaded - cool, thanks!

Just to bring an error message up, though:

[cds] - serving SidecarProvisioningService { at: '/mtx/v1/internal/provisioning' }
[ERROR] Property 'user' should be a non-empty string

That leads me there:

function _getServiceCredentials() {
    const cds = require('../../cds');

    if (!cds.env.requires.db) {
        support(ERRORS.hanaServiceMissing, logger);
        throw new Error('HANA credentials could not be found.');
    }

    if (!cds.env.requires.db.credentials) {
        support(ERRORS.hanaCredentialsMissing, logger);
        throw new Error('HANA credentials could not be found.');
    }

    return cds.env.requires.db.credentials;
}

Okay, it's looking for a requires.db, some credentials, and specifically for a managed-hana instance manager as one can see by the options it requires. I have been told that this is obsolete as it is a HaaS item and on SAP HANA Cloud we work with the service-manager, plan = container.

Heading over to the Help I read that the service SAP HANA Schemas & HDI Containers (hana) is required. This one does not have the URLs needed for the instance management, they are just part of the lib. So, heading over to the App Managed SAP HANA Schemas & HDI Containers I read that this is the Hana service - and, as expected, this one has the URL entries.

Now I'm completely confused. Are HANA Cloud and HaaS handled different or ist it just fine for mtx if I add the latter service or is there another setting I'm missing?

Thanks

Mathias