Trace is not available because response does not contain Apim-Trace-Id header.

Dave Willard 41 Reputation points
2024-07-25T21:18:13.21+00:00

Observing when I select Test-> Trace: "Trace is not available because response does not contain Apim-Trace-Id header."

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,171 questions
{count} vote

Accepted answer
  1. JananiRamesh-MSFT 27,911 Reputation points
    2024-07-26T07:17:12.5333333+00:00

    @Dave Willard Thanks for reaching out. The process of enabling tracing has been now changed due to security reasons, previously we were adding OCP-APIM-Trace = true.

    Please refer the setps in the below document to enable tracing for an api https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-api-inspector#enable-tracing-for-an-api.

    https://learn.microsoft.com/en-us/rest/api/apimanagement/gateway/list-trace?view=rest-apimanagement-2023-09-01-preview&tabs=HTTP#code-try-0 this rest api will return the trace similar to the trace you can see by tracing a call in the portal's test console.

    To see the trace in azure portal click on Trace button you will get a warning but still you will be able to see the trace as shown below
    User's image

    do let me know incase of further queries, I would be happy to assist you.

    Please accept as Yes if the answer provided is useful, so that you can help others in the community looking for remediation for similar issues.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. NGANDU-BISEBA Gabriel 40 Reputation points
    2024-09-13T08:21:05.0333333+00:00

    This is a bug the APIM team is aware of. For now, the proposed workaround is to use this link when accessing the portal for a tracing session https://portal.azure.com/?microsoft_azure_apimanagement_newTracing=false

    4 people found this answer helpful.
    0 comments No comments

  2. hossein jalilian 8,080 Reputation points
    2024-07-25T21:57:30.3133333+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    It can be resolved by following these steps:

    1. Ensure tracing is enabled for your API, navigate to your API Management instance in the Azure portal and select the API you want to trace then go to the "Settings" tab , under "Diagnostics", make sure "Enable tracing" is turned on.
    2. Add the Ocp-Apim-Trace header and set it to true and include the "Ocp-Apim-Subscription-Key" header with a valid subscription key
    3. Traces are only generated for requests using admin subscription keys ,to get the admin key, go to the Developer Portal -> Profile -> find your target API and copy the key
    4. Make sure Allow tracing is enabled for the subscription whose key you're using

    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.