cancel
Showing results for 
Search instead for 
Did you mean: 

Could not find service binding of type 'destination'.

goayle
Discoverer
0 Kudos
120

I am a beginner in CAP and using destination, but I keep encountering errors. I have already configured the destination in Cockpit, and the connectivity test works fine. However, when I try to connect using code, I keep getting the following error. Could you please tell me what step is missing in this binding?

error message:
[2025-04-24T06:24:19.328Z] WARN (environment-accessor): Could not find service binding of type 'destination'. This might cause errors in other parts of the application.
[cds] - Error: Could not find service binding of type 'destination'.
at resolveServiceBinding (/home/user/projects/incident-management/node_modules/@sap-cloud-sdk/connectivity/dist/scp-cf/environment-accessor/service-bindings.js:86:19)
at serviceToken (/home/user/projects/incident-management/node_modules/@sap-cloud-sdk/connectivity/dist/scp-cf/token-accessor.js:27:77)
at getProviderServiceToken (/home/user/projects/incident-management/node_modules/@sap-cloud-sdk/connectivity/dist/scp-cf/destination/get-provider-token.js:12:61)
at Object.getAllDestinationsFromDestinationService (/home/user/projects/incident-management/node_modules/@sap-cloud-sdk/connectivity/dist/scp-cf/destination/destination-accessor.js:99:65)
at async ProcessorService.getInternalData (/home/user/projects/incident-management/srv/services.js:113:17)
at async next (/home/user/projects/incident-management/node_modules/@sap/cds/lib/srv/srv-dispatch.js:64:17)
at async ProcessorService.handle (/home/user/projects/incident-management/node_modules/@sap/cds/lib/srv/srv-dispatch.js:62:10)
at async ProcessorService.handle (/home/user/projects/incident-management/node_modules/@sap/cds/libx/_runtime/common/Service.js:81:16)
[error] - 500 > {
code: '500',
message: "Could not find service binding of type 'destination'."
}
 
code :
 
const destination = await connect.getDestination('test')
console.log("destination", destination);
const res1 = await httpClient.executeHttpRequest(destination);
console.log("after result", res1);
 
or using the mock destinations, still the same error message:
 
const reg = await connect.registerDestination({name: 'test', url: 'https://google.com'});
console.log(reg);
console.log('--------------------');
const all = await connect.getAllDestinationsFromDestinationService();
console.log(all);
 
 
 
 
 
 
 
 
View Entire Topic
ArunJacob
Active Participant
0 Kudos

Hi,

This usually means your application is not correctly bound to the Destination service on BTP.  Please ensurepackage.json has an entry for the destination "test" in the following under cds.requires

"cds": {
  "requires": {
    "test-destination": {
      "kind": "rest",
      "credentials": {
        "destination": "test"
      }
    }
  }
}

Thanks,

goayle
Discoverer
0 Kudos
Thank you, very much!
goayle
Discoverer
0 Kudos
Thank you, very much! This code still shows the same error both locally and in WebIDE, even after adding all the configurations. I want to understand if this binding needs to be handled manually. In my understanding, since I've already added the destination in the SAP BTP Cockpit, it should work directly in WebIDE. It feels like there's a missing step in the destination setup process.