on 12-29-2022 7:25 PM
Hello.
I have a multi tenancy enabled CAPM project - CRM . This has an app router and a srv application deployed in my dev CF space.
I created another capm project SAAS . I am consuming CRM service from SAAS project following capire. package.json of SAAS application is like this.
"CRMService": {
"kind": "odata-v4",
"model": "srv/external/CRMService",
"[production]": {
"credentials": {
"destination": "CRMSRV",
"path": "/crm"
}
}
}
These applications are deployed in BTP Trial sub-account . I created a destination service and a service key , to maintain "CRMSRV" destination ( using OAuth2UserTokenExchange , pointing to srv url of CRM service ) and bound it to SAAS srv application.
From the same Trial account, I created subscription for both CRM & SAAS. Post setting up routes and reroute URL , through saas subscription endpoint , I can reach CRM service - the destination is properly picked up .
Later I created another (consumer) sub-account and subscribed to both CRM and SAAS . CRM url can access the corresponding entity set data and SAAS can access its own. But, when I use SAAS url to fetch CRM data ( since SAAS has CRM api consumption setup ) , I get "Error during request to remote service: Failed to load destination" . sWhat am I missing ?
1 - If I am not creating a destination in consumer sub-account , mustn't it consider the destination of provider sub-account ?
2 - If I must create a destination in consumer sub-account, what would be the target URL ? consumer sub-account URL of CRM ? I tried this and failed.
Is it something missing in the Service.js I implemented ?
Service.js
Error from log
Failed to load destination. Caused by: Could not fetch client credentials token for service of type "destination". Caused by: undefined
Sreehari
Update :
following this issue raised by Gregor here . for me, request.attr.token is undefined . But , retrieveJwt function from sap-cloud-skd retrieves it - Console says request.attr is deprecated . I don't see an option in
service.tx(request).run(request.query);
to propagate the jwt explicitely .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does you MTX app return the dependency for the destination service as I've described in Documentation: Deploy SaaS Solutions (MTX) - Dependencies to Destination / Connectivity Service?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes I have tried that.
uaa.user scope was missing in my xs-security.json , added that as well and tried. Stands at the same place - Provider account's own subscription works fine. When consumed from another sub-acccount , the call fails with error
Failed to load destination. Caused by: Could not fetch client credentials token for service of type "destination". Caused by: undefined'.
I am using "OAuth2UserTokenExchange" as authentication type. Also tried with OAuth2ClientCredential. Must I be using something else ? I am trying to make one scenario work .
>> I used "Common" token service url with {tenant} placeholder. This behaves the same as well. I tried to fetch the token from postman , using OAuth credential ( using tenant.authentication...ondemand.com/oauth/token , and it works fine there )
Sreehari
Hi sreehari.vpillai ,
did You overcome this issue maybe and somehow :). It would be great if You could serve with some good news. At least to get some hope here 🙂 !
I also added connectivity to mta.yaml, and bound it to the application.
Besides I added the code suggested by Gregor here and also added connectivity to getDependencies handler, but unable to get the destination, even doing a new subscription again.
It still runs to issue
TypeError: this.options.selectionStrategy is not a function
at DestinationFromServiceRetriever.getSubscriberDestinationService <br>
Thank You
Best regards
Attila
Update 16.Match.2023
I was told a "magic trick" to overcome the issue, since increasing the CAP versions in package.json did not help. In case You need the subscriber destination fetched first in node.js, then better completely ignore the "alwaysSubscriber" part, due it is the default. After removing it, the above exception in CAP runtime disappeared.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
been there , faced all these myself. I gave up ( its a shame to say that ) after numerous failed attempts.
But , I will be there soon - I am retrying it . If it still fails, I will raise a support incident ( yes , I'm SAP customer now ) and get SAP expert's help on this.
keep you posted.
Sreehari
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.