Skip to content

Conversation

@PDT42
Copy link
Contributor

@PDT42 PDT42 commented Dec 3, 2025

Relates to: #389

Problem

Currently, when using VCAP_SERVICES_FILE_PATH via CF feature flag file-based-vcap-services, a user provided service instance of Cloud Logging (or dynatrace) will not be correctly resolved. The relevant local util:

telemetry/lib/utils.js

Lines 114 to 130 in ae3e619

function getCredsForCLSAsUPS() {
if (!process.env.VCAP_SERVICES) return
const vcap = JSON.parse(process.env.VCAP_SERVICES)
let ups
// to support connection via user-provided services, the instance must have either tag "cloud-logging" or "Cloud Logging"
ups = vcap['user-provided']?.find(e => e.tags.includes('cloud-logging') || e.tags.includes('Cloud Logging'))
if (ups) return ups.credentials
// legacy compat
ups = vcap['user-provided']?.find(b => b.name.match(/cloud-logging/))
if (ups) {
// prettier-ignore
LOG._warn && LOG.warn('User-provided service instances of SAP Cloud Logging should have either tag "cloud-logging" or "Cloud Logging"')
return ups.credentials
}
}

... is not equipped to resolve binding information from anywhere but the VCAP_SERVICES env variable.

Fix

However, the existing cds.env is - given we provide the correct matching predicate in cds.requires.telemetry.vcap. Currently, we use:

telemetry/package.json

Lines 126 to 128 in ae3e619

"vcap": {
"label": "cloud-logging"
},

... but instruct integrating developers to add cloud-logging to the tags of the user provided service, rather than a label. It looks like the label of user provided services will always be user-provided. Matching of user-provided services works out, if the integrating developer updates their local config like:

{
  "cds": {
    "requires": {
      "telemetry": {
        "vcap": {
          "label": false,
          "tag": "cloud-logging"
        }
      }
    }
  }
}

... as described in CAPire: https://cap.cloud.sap/docs/node.js/cds-connect#vcap_services

Solution

Since it seems, a non-user-provided instance comes tagged with Cloud Logging by default, we might want to consider updating our default matching predicate in package.json accordingly and get that much closer to what's described in the cloud logging docs. This PR suggests the required changes.

Less Intrusive Alternative

In case we do not want to update our default matching predicates, we should update the README with the config section, that will cause label to be ignored during matching, from above.

@PDT42 PDT42 marked this pull request as ready for review December 4, 2025 10:56
@PDT42 PDT42 requested a review from sjvans December 4, 2025 10:56
@PDT42 PDT42 changed the title feat: VCAP_SERVICES_FILE_PATH compatibility chore: VCAP_SERVICES_FILE_PATH compatibility Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants