SAP/cloud-sdk

Failure to resolve a destination - Empty Body with status 302

raynalje opened this issue · 1 comments

Issue Description

A customer is using a destination in our product. We are facing an issue when trying to resolve this specific customer's destination.
We have the following error in our stack trace :

Caused by: com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException: Failed to read authentication token. The destination service responded with an error: Empty Body with status 302 and message Found comes from the OAuth Service!
    at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfHttpDestinationPropertyFactory.throwOnHeaderError(ScpCfHttpDestinationPropertyFactory.java:387)
    at java.base/java.util.stream.ReferencePipeline$15$1.accept(Unknown Source)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
    at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
    at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfHttpDestinationPropertyFactory.getDestinationHeaders(ScpCfHttpDestinationPropertyFactory.java:380)
    at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfHttpDestinationPropertyFactory.getHeadersFromDestination(ScpCfHttpDestinationPropertyFactory.java:287)
    at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfHttpDestination.<init>(ScpCfHttpDestination.java:173)
    at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfHttpDestination.<init>(ScpCfHttpDestination.java:79)
    at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestination.asHttp(ScpCfDestination.java:57)

We contacted the destination service that redirected us to you. NGPBUG-358871
I can't test the destination via HTTP call as It would require customer credentials.

Impact / Priority

In Production : 2 customer issues with business impact - high priority.

Error Message

Caused by: com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException: Failed to read authentication token. The destination service responded with an error: Empty Body with status 302 and message Found comes from the OAuth Service!
    at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfHttpDestinationPropertyFactory.throwOnHeaderError(ScpCfHttpDestinationPropertyFactory.java:387)
    at java.base/java.util.stream.ReferencePipeline$15$1.accept(Unknown Source)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
    at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
    at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfHttpDestinationPropertyFactory.getDestinationHeaders(ScpCfHttpDestinationPropertyFactory.java:380)
    at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfHttpDestinationPropertyFactory.getHeadersFromDestination(ScpCfHttpDestinationPropertyFactory.java:287)
    at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfHttpDestination.<init>(ScpCfHttpDestination.java:173)
    at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfHttpDestination.<init>(ScpCfHttpDestination.java:79)
    at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestination.asHttp(ScpCfDestination.java:57)

Project Details

  • It's an SAP product.
  • SAP Cloud SDK Version: 4.16.0 com.sap.cloud.sdk.cloudplatform
  • Project type, for example:
    • CAP Project
    • SAP Cloud SDK Maven Archetype
    • None of the above: SAP product
  • Platform:
    • Cloud Foundry - SAP BTP
    • Neo
    • None of the above:

Checklist

  • Checked out the documentation and Stack Overflow
  • Description provided with all relevant information
  • Attached debug logs
  • Attached dependency tree
  • Provided the SAP Cloud SDK version & link to relevant source code

The message:

Empty Body with status 302 and message Found comes from the OAuth Service!

... is an error reported by Destination Service, while it tried to resolve some OAuth token.

  • SAP Cloud SDK is only propagating the error message to you as exception.
  • Destination Service seems to not following 302 redirects. Maybe some destination property has not the correct URL.
  • Please make sure the OAuth2 server address is absolute correct, including domains, paths and especially schema (http vs. https). This is the Token Service URL in a destination.