Custom Connector Returns HTTP 200 but Fails in Copilot Agent with ConnectorRequestFailure.

Mamta Patil 20 Reputation points
2025-07-21T11:39:31.15+00:00

Hi everyone,

I'm encountering an issue while testing a custom connector in Copilot Studio. The connector is successfully tested in the Custom Connector Test tab, and it returns a valid HTTP 200 response with the expected OData payload. However, when I use this connector as a tool in a Copilot agent topic, I receive the following error:
User's image

What I’ve Done So Far:

  • Added a 'default response schema' using a simplified sample of the actual response.
  • Set the 'Content-Type' header to application/json.
  • Limited the response using $top=5 and selected only a few fields.
  • Verified that the connector returns a clean, valid JSON response.
  • Tried using /Connector-GWSample.Run() => $response in the topic and added a Trace($response) step.

Despite all this, the connector still fails when used in a topic.

Sample Response Schema Used:

{
  "d": {
    "results": [
      {
        "BusinessPartnerID": "0100000000",
        "CompanyName": "SAP",
        "EmailAddress": "******@sap.com"
      }
    ]
  }
}

What else could be causing this ConnectorRequestFailure even though the HTTP status is 200 and the response is valid? Is there a specific format or limitation Copilot Studio expects that I might be missing?

Any help or guidance would be greatly appreciated!

Thanks in advance.

Microsoft Copilot | Microsoft 365 Copilot | Development
{count} votes

Answer accepted by question author
  1. Karan Shewale 2,465 Reputation points Microsoft External Staff
    2025-07-22T07:46:30.3333333+00:00

    Hi Mamta,

    This is a common issue with custom connectors in Copilot Studio. Even though your connector returns HTTP 200, there are several Copilot-specific requirements that could be causing the ConnectorRequestFailure. Here are the most likely causes and solutions:

    Common Causes & Solutions

    1. Response Schema Mismatch

    The most common issue is a mismatch between your defined schema and actual response structure.

    Solution:

    • In your custom connector, go to Definition → Response
    • Ensure the schema exactly matches your actual response structure
        For your OData response, the schema should be:
        {
          "type": "object",
          "properties": {
            "d": {
              "type": "object",
              "properties": {
                "results": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "BusinessPartnerID": {"type": "string"},
                      "CompanyName": {"type": "string"},
                      "EmailAddress": {"type": "string"}
                    }
                  }
                }
              }
            }
          }
        }
      

    2. Missing Required Headers

    Copilot Studio is stricter about headers than the test interface.

    Add these headers to your connector definition:

    • Content-Type: application/json
    • Accept: application/json
    • Consider adding Cache-Control: no-cache

    3. Authentication Context Difference

    The connector test uses different auth context than when called from a topic.

    Check:

    • Is your API expecting specific authentication headers?
    • Try adding explicit authentication parameters in the connector definition
    • Verify the service account/connection has proper permissions

    4. Response Size/Timeout Issues

    Copilot Studio has stricter limits than the test interface.

    Try:

    • Reduce response size further (try $top=1)
    • Add timeout handling in your API
    • Ensure response time is under 30 seconds

    5. OData Format Handling

    Copilot Studio might have issues with OData envelope format.

    Consider flattening the response: Instead of returning the OData envelope, modify your API or

    connector to return:
    [
      {
        "BusinessPartnerID": "0100000000",
        "CompanyName": "SAP",
        "EmailAddress": "******@sap.com"
      }
    ]
    

    Debugging Steps

    1. Enable Detailed Logging

    In your topic, add more trace statements:
    Trace("Before connector call")
    Set(varResult, Connector-GWSample.Run())
    Trace("Response: " & Text(varResult))
    Trace("Error: " & Text(IsError(varResult)))
    

    2. Test with Simplified Response

    Temporarily modify your API to return a very simple response:

    {"test": "success"}
    

    3. Check Connector Permissions

    • Verify the connector is shared properly with your Copilot
    • Check if there are any environment-specific restrictions

    Quick Fix to Try

    Since you're getting ConnectorRequestFailure specifically, try this:

    1. Recreate the connector with a minimal schema
    2. Test with the simplest possible response first
    3. Gradually add complexity until you identify what breaks it

    The fact that it works in the connector test but fails in the topic strongly suggests a schema/format issue rather than a connectivity problem.

    Thanks,  

    Karan Shewale. 

    *************************************************************************  

    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate. 




1 additional answer

Sort by: Most helpful
  1. Karan Shewale 2,465 Reputation points Microsoft External Staff
    2025-07-22T07:39:15.4266667+00:00

    Thanks for bringing this issue to our attention. We will check and update you soon.

    0 comments No comments

Your answer

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