Skip to Content
Technical Articles
Author's profile photo Jijia Guan

Debug external service in local VS code for CAP

What: This blog post will show how to debug with external service for the CAP(SAP Cloud Application Programming Model) project in local IDE.

Why: When develop the CAP project, we always integrate with other SAP BTP service. If in SAP BAS(Business Application Studio), you can easily bind external service to your application to debug. Also recently, run CAP Java Apps with service bindings is not supported yet. So when debug with local VS code, you should try another way.


Suppose you will need a Malware Service for scan uploaded file.

Firstly you should create a new malware-scanner service. Then bind it to your application. After that, you can check the System-Provided Environment Variables.

It will likes like:

        "malware-scanner": [
                "label": "malware-scanner",
                "provider": null,
                "plan": "clamav",
                "name": "malware-service",
                "tags": [],
                "instance_guid": "xxxxx",
                "instance_name": "malware-service",
                "binding_guid": "xxxxx",
                "binding_name": null,
                "credentials": {
                    "uri": "",
                    "sync_scan_url": "",
                    "async_scan_url": "",
                    "username": "xxxxx",
                    "password": "xxxxx"
                "syslog_drain_url": null,
                "volume_mounts": []
        "hana": [...

Then you can copy all content into your local project’s “default-env.json” file. If not exist, you can create one in root path.


After preparation done. You will need export this file as system variables. Open the terminal in the project root path, then enter following command:

TMP_VCAP_SERVICES=$(jq '.VCAP_SERVICES' default-env.json|jq -c .)


Then your local PC have same VCAP_SERVICES as on BTP. You can start your application to debug as normal now.

PS: You need install jq.node first;

npm install jq.node -g


In conclusion, when we development CAP Java project in local environment, we can fetch remote service via url link defined in system environment. Further more, you can refer to capire – Hybrid Testing (

One day it should support CAP Java for service bindings.

Any suggestions and ideas are most welcome!


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Vladimirs Semikins
      Vladimirs Semikins

      Your link looks like lead to the internal SAP page, but I guess you are referring to this one -

      Author's profile photo Jerry Janda
      Jerry Janda

      Thank you for bringing to our attention. We'll correct the link.

      Kind regards,