Search code examples
s4sdkdynatracesap-cloud-platform

Receiving 404 error when trying to integrate dynatrace agent into s4sdk-based application


I am trying to integrate dynatrace with my s4sdk-based application following the steps mentioned here:

https://www.dynatrace.com/support/help/cloud-platforms/cloud-foundry/application-only/deploy-oneagent-on-sap-cloud-platform-for-application-only-monitoring/

Only exception: I am using a trial account of dynatrace instead of setting up an account via SAP marketplace.

When trying to push my application I receive the following error during the staging phase:

Staging app and tracing logs...
   [...]
   Downloaded 'PostgreSQL JDBC Driver', version '42.2.5' in 0.2 s.
   Downloaded 'SAP JVM Memory Calculator', version '1.8.0' in 0.1 s.
   SEVERE: Unhandled exception in Buildpack main method: https://[envId].live.dynatrace.com/api/v1/deployment/installer/agent/unix/paas/latest?include=java&bitness=64&Api-Token=[apiToken] returned '404', download failed.Failed to compile droplet: Failed to compile droplet: exit status 9
   Exit status 223

EDIT: Accessing the link from my PC or after connecting to the container via ssh works without any problem.

So the question to me is whether I am required to use the SAP app center for aquiring dynatrace, or if the error lies somewhere else?

Configuration for user-provided service named dynatrace-service:

{
    "apitoken": "[apiToken]",
    "environmentid": "[envId]",
    "tag:SAP CP": "",
    "tag:Region": "Frankfurt"
}

Setup in manifest.yml of my application:

---
applications:

- name: address-manager
  memory: 1024M
  timeout: 300
  random-route: true
  path: application/target/address-manager-application.jar
  buildpacks:
    - sap_java_buildpack
  env:
    TARGET_RUNTIME: main
    SPRING_PROFILES_ACTIVE: 'cloud'
    JBP_CONFIG_DEBUG: '{enabled: true}'
  services:
    - my-xsuaa
    - my-destination
    - my-logging-service
    - dynatrace-service

Solution

  • First, to answer your question:

    So the question to me is whether I am required to use the SAP app center for aquiring dynatrace, or if the error lies somewhere else?

    To validate that I also registered for a trial account on Dynatrace and successfully could connect a to an SAP S/4HANA Cloud SDK based application running in my SAP Cloud Platform trial account on hanatrial.ondemand.com. Thus it should work and the error lies somewhere else.

    My guess is that your environment id might not be correct. Thus, I did the following experiment: I changed the environment id to an invalid one in the user provided service and pushed again. I got the same error message as you have experienced:

    SEVERE: Unhandled exception in Buildpack main method: https://[envid].live.dynatrace.com/api/v1/deployment/installer/agent/unix/paas/latest?include=java&bitness=64&Api-Token=[token] returned '404', download failed.Failed to compile droplet: Failed to compile droplet: exit status 9
    

    I also clicked on the link in the log which returns 404. It shows an error message in addition to the 404 status code.

    In my case it showed:

    {
      error: {
        code: 404,
        message: "failed to resolve tenant <abcdef>"
      }
    }
    

    Please check again if the environment id is correct and open the link in the log to get more information.