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

CAP Multitenancy Connectivity

jerinjacob
Explorer
0 Kudos
3,542

Hi Experts,

I have developed a CAP NodeJS multi-tenant (based on SAP HANA Academy yeoman generator) app that require certain services from on-premise system. The app runs perfectly in multi-tenant mode when using destination service (via internet and uses basic authentication) to connect to external service. Now, I need to run the destination service with connectivity service. The on-prem system is added to the tenant subaccount's cloud connector, changed the destination service proxy type to 'on-premise', added connectivity service to mta.yaml file of app and linked it to the app-srv application(from which the external service is called). But unfortunately it raises an error as below:

'Error during request to remote service: Failed to load destination. Caused by: Failed to add proxy authorization header - client credentials grant failed! Caused by: Could not fetch client credentials token for service of type "connectivity". Caused by: Request failed with status code 401'

How can I solve this issue or am i missing something?

Many thanks,

Jerin Jacob

Accepted Solutions (1)

Accepted Solutions (1)

gregorw
SAP Mentor
SAP Mentor
0 Kudos
jerinjacob
Explorer
0 Kudos

Thanks Gregor, for the wonderful blog!

As the blog suggests, I had to add connectivity as a dependency to the 'srv' app. Also, I used a custom event handler for https://{consumer}-srv.${default-domain}/mtx/v1/provisioning/dependencies; and thus had to add connectivity's xsappname here :

service.on('dependencies', async (req) => {
return [{
'xsappname': services.dest.xsappname
},
{
'xsappname': services.conn.xsappname
}];
});
gregorw
SAP Mentor
SAP Mentor
0 Kudos

Are you not using the @sap/cap-mtx package? Then my code sample should have worked for you.

Answers (0)