Skip to content

[Core] Response content is redacted on successful status codes #49378

Open
@kinelski

Description

@kinelski

Long-running operations

Long-running operations in Azure follow a specific REST pattern:

  1. The customer initiates the operation by sending a POST request to the Azure service.
  2. Subsequently, the customer sends successive GET requests to poll for the status of the long-running operation. The polling continues until it either succeeds or fails.

In the event of a failure, the polling GET request returns a 200 status code along with an error message. The 200 status code indicates that the polling request itself succeeded, even though the operation has failed. Customers can check the response body to obtain additional information about what caused the failure.

Issue

In the implementation of our RequestFailedException class, we intentionally redact the response body of HTTP requests when the status code returned is successful. While we expose the actual error code and the main error message, additional properties such as inner error details are hidden with the following message:

Service request succeeded. Response content and headers are not included to avoid logging sensitive data.

This behavior can be problematic for customers who need detailed error information to diagnose and resolve issues.

Workaround

As a workaround, customers can use the GetRawResponse method in RequestFailedException to access the raw response. However, they will need to parse the JSON response manually to extract the required error details.

try
{
    // Code that polls for the status of the failed long-running operation
}
catch (RequestFailedException ex)
{
    Response rawResponse = ex.GetRawResponse();
    // Parse the rawResponse to get additional error details
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Azure.CoreClientThis issue points to a problem in the data-plane of the library.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions