cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect and test CAP application locally with destinations using hybrid profile?

kaizen9
Explorer
0 Kudos
262

Hello supporters,
I do not want to deploy and test application, as developer, I would like to test app locally before push.
Running hybrid profile worked but returned empty array.

Why it shows empty array to me? What did I miss?

I am using Business Application Studio - BAS

It works in Postman.

kaizen9_0-1743431315957.png

cds watch --profile hybrid
cds serve all --with-mocks --in-memory? --profile hybrid 
live reload enabled for browsers
resolving cloud service bindings...
bound destinations to Cloud Foundry managed service opps-mta-destination:opps--destination-key
bound auth to Cloud Foundry managed service opps-mta-xsuaa:opps-mta-xsuaa-key
----
[cds] - mocking OPPS_DataAccessV4 { path: '/odata/v4/opps-data-access-v4' }
[cds] - server listening on { url: 'http://localhost:4004' }
----

 

Update: 
Is there anything wrong in my Run Configuration?

Why I don't see Live Data option also?  based on Run Config documentation.

Step 1 try: 

kaizen9_2-1743519999905.png

I turned the option to -> "Mock external OData services (Off)"

[cds] - connect to db > sqlite {url: ':memory:'}
/> successfully deployed to in-memory database. 
Process exited with code 1
Error: No credentials configured for "OPPS_DataAccessV4".
    at RemoteService.init (/home/user/projects/opps-promotions-api-mta/node_modules/@sap/cds/libx/_runtime/remote/Service.js:223:13)

When clicked on 3rd option "OPPS_DataAccessV4 - OData" in order to Bind it, then got strange error:

kaizen9_0-1743519695437.png

Step 2 try:

kaizen9_0-1743543853155.png

I turned the option to ->  "Mock external OData services (On)" and I got error:

Process exited with code 1
[cds] - using auth strategy {kind: 'xsuaa', impl: 'node_modules/@sap/cds/lib/auth/jwt-auth'} 
Error: Authentication kind "xsuaa" configured, but no XSUAA instance bound to application. Either bind an XSUAA instance, or switch to an authentication kind that does not require a binding.

How to fix this?

We really need to solve this. Please support, Thanks.

@vvdries @gregorw @qmacro @martinfrick @martinstenzig @WouterLemaire @Marian_Zeis 
@showkath_naseem @LucasBorin @massimiliano_cardosi @rotem_puterman-sobe @MariamIdman

I referred these posts: 

https://community.sap.com/t5/technology-blogs-by-sap/btp-cap-how-to-connect-to-remote-services-local...

https://community.sap.com/t5/technology-blogs-by-members/sap-cap-hybrid-testing/ba-p/13556582

https://community.sap.com/t5/technology-q-a/btp-cap-connect-to-remote-service-locally-hybrid/qaq-p/1...

 

View Entire Topic
rotem_puterman-sobe
Product and Topic Expert
Product and Topic Expert

Hi,

According to the update in your question and the added screenshots of run configuration, it seems you are not using the recommended Run Configuration option.

I recommend on creating a new Run Configuration for your project, and making sure to select the option marked with "(CAP Node project)". Then you will get much more options than in the screenshot presented, including selecting the authentication mode, OData with live data, etc.

Please note that this option is available in dev spaces of type "Full-Stack Application using Productivity Tools". In case you are using a different dev space type, I suggest to create a new dev space with this type and clone your project to it.

Thanks,

Rotem