Skip to Content
0
Aug 11, 2023 at 01:08 PM

Consume service that database host in other subaccount

126 Views Last edit Aug 11, 2023 at 01:55 PM 2 rev

Hello!!!

I'm trying to consume a CAP service with other CAP service but my database is host in other subaccount.

I have binded the instance of the database with cds bind -2 dbinstance:dbinstance-key. and when I run cds watch --profile hybrid.

module.exports = async (srv) => { srv.on('READ', 'Test', async (req, next) => {
try { const ServiceOne = await cds.connect.to('ServiceOne');
const { EntityOne } = ServiceOne.entities console.table(EntityOne);
const result = await srv.run(SELECT.from(EntityOne)) console.table(result);
} catch (oError) { }

});
}

In my first console.table I got the details of the entity but with my second console.table: Could not establish connection for tenant "undefined" due to error: No authentication method found.

How I can do the connection to the database from othe Subaccount?

Thank you very much!