on 2025 Mar 13 10:57 PM
Aqui está o post atualizado em inglês:
I am working on a SAP CAP project with a hybrid configuration, and I need to connect to an ABAP Cloud destination locally. The destination is properly configured, and I can reach it using curl.
Sensitive details are replaced with ***:
{ "requires": { "[hybrid]": { "auth": { "binding": { "type": "cf", "apiEndpoint": "https://api.cf.***.hana.ondemand.com", "org": "***", "space": "dev", "instance": "teste-auth", "key": "teste-auth-key", "resolved": false }, "kind": "xsuaa-auth", "vcap": { "name": "auth" } }, "destinations": { "binding": { "type": "cf", "apiEndpoint": "https://api.cf.***.hana.ondemand.com", "org": "***", "space": "dev", "instance": "teste-destination", "key": "teste-destination-key", "resolved": false }, "kind": "destinations", "vcap": { "name": "destinations" } }, "connectivity": { "binding": { "type": "cf", "apiEndpoint": "https://api.cf.***.hana.ondemand.com", "org": "***", "space": "dev", "instance": "teste-connectivity", "key": "teste-connectivity-key", "resolved": false }, "kind": "connectivity", "vcap": { "name": "connectivity" } }, "API_PESSOAS": { "credentials": { "destination": "abap-cloud-default_abap-trial-***", "forwardAuthToken": false } } } } }
When running the following command:
curl -v abap-cloud-default_abap-trial-***.dest
I get a successful response (HTTP 200), confirming that the destination is reachable:
{"@odata.context":"$metadata","value":[{"name":"ZC_PESSOAS","url":"ZC_PESSOAS"}]}
However, when I try to run cds watch --profile hybrid to connect from CAP to the ABAP Cloud destination, I receive the following error:
Error during request to remote service: Failed to load destination. Caused by: No user token (JWT) has been provided. This is strictly necessary for 'OAuth2UserTokenExchange'.
This is how I am executing the external connection:
try { const ExternalPessoas = await cds.connect.to('API_PESSOAS'); return await ExternalPessoas.run(req.query); } catch (error) { LOG.error(error); }
When deployed to SAP BTP, the destination works correctly, and I receive the expected response:
{ "@odata.context": "$metadata#Pessoas", "@odata.metadataEtag": "W/\"20250311171855\"", "value": [ { "Cpf": "12345678911", "Nome": "Fabricio", "Idade": 29, "SAP__Messages": [] } ] }
Any insights or suggestions would be greatly appreciated! 🚀
Request clarification before answering.
Hi,
If you are using SAP Business Application Studio for developing your application I suggest you to use the Run Configuration panel to create appropriate configuration to test your application with live data from your destination (and also possibly connect to XSUAA service instance for authentication).
See documentation here: https://help.sap.com/docs/bas/developing-business-applications-using-productivity-tools/testing-appl...
Make sure that your devspace is of type "Full-Stack Application Using Productivity Tools" which allows you working with Run Configuration tool in addition to more tools which are designed to enhance your productivity while developing CAP applications.
Thanks,
Rotem
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
9 | |
8 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.