JSON Threat Protection ランタイム エラーのトラブルシューティング

現在、Apigee Edge のドキュメントを表示しています。
Apigee X のドキュメントをご確認ください
情報

ExecutionFailed

エラーコード

steps.jsonthreatprotection.ExecutionFailed

エラー レスポンスの本文

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Execution failed. reason: JSONThreatProtection[policy_name]: error_description
          at line line_num",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

エラーの種類と考えられる原因

JSONThreatProtection ポリシーでは、さまざまな種類の ExecutionFailed エラーをスローできます。次の表に、さまざまな種類のエラーと考えられる原因を示します。

エラーの種類 原因
オブジェクト エントリ名の長さの超過 オブジェクトのエントリ名が文字列の最大許容長を超えています。
オブジェクト エントリ数の超過 オブジェクトのエントリ数が最大許容数を超えています。
配列要素数の超過 配列内の要素の数が最大許容数を超えています。
コンテナ深度の超過 ネストされた深度が最大許容深度を超えています。
文字列値の長さの超過 文字列値の長さが最大許容長を超えています。
無効な JSON オブジェクト 入力 JSON ペイロードが無効です。

オブジェクト エントリ名の長さの超過

エラー レスポンスの本文

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Execution failed. reason: JSONThreatProtection[policy_name]:
          Exceeded object entry name length at line line_num",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

エラー レスポンスの本文の例

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]:
          Execution failed. reason: JSONThreatProtection[JSON-Threat-Protection-1]:
          Exceeded object entry name length at line 2",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

原因

このエラーは、<Source> 要素で指定された入力メッセージ ペイロードに含まれる JSON オブジェクトのプロパティ名が、<ObjectEntryNameLength> 要素で指定された最大長を超える場合に発生します。

たとえば、ポリシーで <ObjectEntryNameLength> 要素が 5 と指定されているのに、入力メッセージ ペイロードにある JSON プロパティの名前が 5 文字を超える場合は、このエラーがスローされます。

診断

  1. エラー メッセージを調べて、JSONThreatProtection ポリシー名と長いエントリ名が表示される行番号を特定します。たとえば、次のエラー メッセージでは、JSONThreatProtection ポリシー名は JSON-Threat-Protection-1、ペイロードの行番号は 2 です。

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded object entry name
    length at line 2
    
  2. 手順 1 で特定したポリシーを調べ、<ObjectEntryNameLength> 要素で指定された値をメモします。

    たとえば、次の JSONThreatProtection ポリシーでは、<ObjectEntryNameLength>5 に設定されています。

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
        <DisplayName>JSON Threat Protection-1</DisplayName>
        <Properties/>
        <ArrayElementCount>3</ArrayElementCount>
        <ContainerDepth>12</ContainerDepth>
        <ObjectEntryCount>5</ObjectEntryCount>
        <ObjectEntryNameLength>5</ObjectEntryNameLength>
        <Source>request</Source>
        <StringValueLength>50</StringValueLength>
    </JSONThreatProtection>
    
  3. 入力ペイロードの特定の行番号(手順 1 で特定した値)を調べ、オブジェクト名の長さが <ObjectEntryNameLength> 要素で指定された値(手順 2 で特定した値)より大きいかどうかを確認します。オブジェクト名の長さがこの数値を超えている場合は、それがエラーの原因です。

    入力ペイロードの例を次に示します。

    {
       "number" : 500,
       "string" : "text"
    }
    

    上記の JSON ペイロードには、2 行目に 6 文字の number という名前のプロパティがあります(名前の長さは 6 文字)。オブジェクト名の長さが 5(<ObjectEntryNameLength> 要素に指定された値)より大きいため、次のエラーが発生します。

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded object entry name
    length at line 2
    

解像度

JSONThreatProtection ポリシーで、ペイロードに含まれるオブジェクト エントリの名前は定義された値を超えてはならないと定められている場合、エラー メッセージが表示されると予想されます。この場合、追加のアクションを行う必要はありません。

ただし、長いオブジェクト エントリ名をペイロードに指定しても問題ないと判断した場合は、要件に応じて <ObjectEntryNameLength> を適切な値に変更します。

たとえば、オブジェクト名の長さを最大 10 文字まで許容できると判断した場合は、次のように JSONThreatProtection ポリシーを変更します。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
    <DisplayName>JSON Threat Protection-1</DisplayName>
    <Properties/>
    <ArrayElementCount>3</ArrayElementCount>
    <ContainerDepth>12</ContainerDepth>
    <ObjectEntryCount>5</ObjectEntryCount>
    <ObjectEntryNameLength>10</ObjectEntryNameLength>
    <Source>request</Source>
    <StringValueLength>50</StringValueLength>
</JSONThreatProtection>

オブジェクト エントリ数の超過

エラー レスポンスの本文

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Execution failed. reason: JSONThreatProtection[policy_name]:
          Exceeded object entry count at line line_num",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

エラー レスポンスの本文の例

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]:
          Execution failed. reason: JSONThreatProtection[JSON-Threat-Protection-1]:
          Exceeded object entry count at line 7",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

原因

このエラーは、<Source> 要素で指定された入力メッセージ ペイロードに含まれる JSON オブジェクトのエントリ(プロパティ)数が、ポリシーの <ObjectEntryCount> 要素で指定された値よりも多い場合に発生します。

たとえば、<ObjectEntryCount> 要素が 5 であるのに、入力 JSON ペイロードに 5 つ以上のエントリがある場合はこのエラーが発生します。

診断

  1. エラー メッセージを調べて、JSONThreatProtection ポリシー名とエントリ数が超過している行番号を特定します。たとえば、次のエラー メッセージでは、ポリシー名は JSON-Threat-Protection-1、ペイロードの行番号は 7 です。

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded object entry count
    at line 7
    
  2. ポリシーの <ObjectEntryCount> 要素で指定された値(手順 1 で特定した値)をメモします。

    次のポリシーの例では、<ObjectEntryCount>5 に設定されています。

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
        <DisplayName>JSON Threat Protection-1</DisplayName>
        <Properties/>
        <ArrayElementCount>3</ArrayElementCount>
        <ContainerDepth>12</ContainerDepth>
        <ObjectEntryCount>5</ObjectEntryCount>
        <ObjectEntryNameLength>6</ObjectEntryNameLength>
        <Source>request</Source>
        <StringValueLength>50</StringValueLength>
    </JSONThreatProtection>
    
  3. 入力ペイロードの特定の行番号(手順 1 で特定した値)を調べ、ペイロード内のエンティティ数が <ObjectEntryCount> 要素に指定された値(手順 2 で特定した値)より多いかどうかを確認します。オブジェクト数がオブジェクト エントリ数を超えている場合は、それがエラーの原因です。

    入力ペイロードの例を次に示します。

    {
    "name" : "John",
    "id" : 234687,
    "age" : 31,
    "city" : "New York",
    "country" : "USA",
    "company" : "Google"
    }
    

    上記の JSON ペイロードでは、7 行目(company)に 6 つ目のエントリがあります。入力 JSON ペイロード内のオブジェクト エントリの数が 5(<ObjectEntryCount> 要素に指定された値)より大きい場合、次のエラーが表示されます。

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded object entry count at
    line 7
    

解決策

JSONThreatProtection ポリシーで、ペイロードに含まれるオブジェクト エントリの数は特定のしきい値を超えてはならないと定められている場合、エラー メッセージが表示されると予想されます。この場合、追加のアクションは必要ありません。

ただし、より多くのオブジェクト エントリをペイロードに含めても問題ないと判断した場合は、要件に応じて <ObjectEntryCount> を適切な値に変更します。

たとえば、最大 10 個のオブジェクト エントリを許容できると判断した場合は、次のように JSONThreatProtection ポリシーを変更します。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
    <DisplayName>JSON Threat Protection-1</DisplayName>
    <Properties/>
    <ArrayElementCount>3</ArrayElementCount>
    <ContainerDepth>12</ContainerDepth>
    <ObjectEntryCount>10</ObjectEntryCount>
    <ObjectEntryNameLength>6</ObjectEntryNameLength>
    <Source>request</Source>
    <StringValueLength>50</StringValueLength>
</JSONThreatProtection>

配列要素数の超過

エラー レスポンスの本文

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Execution failed. reason: JSONThreatProtection[policy_name]:
          Exceeded array element count at line line-num",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

エラー レスポンスの本文の例

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]:
          Execution failed. reason: JSONThreatProtection[JSON-Threat-Protection-1]:
          Exceeded array element count at line 3",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

原因

このエラーは、<Source> 要素で指定された入力メッセージ ペイロードに、ポリシーの <ArrayElementCount> 要素で指定された数よりも多い要素を持つ JSON 配列が含まれている場合に発生します。

たとえば、<ArrayElementCount> 要素が 3 として指定されているのに、入力ペイロードの JSON 配列に 3 つを超える要素が含まれる場合、このエラーがスローされます。

診断

  1. エラー メッセージを調べて、ポリシー名と配列の長さが超過している行番号を特定します。たとえば、次のエラー メッセージでは、ポリシー名は JSON-Threat-Protection-1、ペイロードの行番号は 3 です。

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded array element count at line 3
    
  2. ポリシーの <ArrayElementCount> 要素で指定された値(手順 1 で特定した値)をメモします。

    次の JSONThreatProtection ポリシーの例では、<ArrayElementCount>3 に設定されています。

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
        <DisplayName>JSON Threat Protection-1</DisplayName>
        <Properties/>
        <ArrayElementCount>3</ArrayElementCount>
        <ContainerDepth>12</ContainerDepth>
        <ObjectEntryCount>5</ObjectEntryCount>
        <ObjectEntryNameLength>6</ObjectEntryNameLength>
        <Source>request</Source>
        <StringValueLength>50</StringValueLength>
    </JSONThreatProtection>
    
  3. 入力ペイロードの特定の行番号(手順 1 で特定した値)を調べ、指定した配列の数が <ArrayElementCount> 要素に指定されている数(手順 2 で特定した値)より多いかどうかを確認します。配列要素の数が超過している場合は、それがエラーの原因です。

    入力ペイロードの例を次に示します。

    {
     "name":"Ford",
     "models":[
        "Mustang",
        "Endeavour",
        "Fiesta",
        "EcoSport",
        "Focus"
     ]
    }
    

    上記の JSON ペイロードでは、3 行目の models という名前の配列内に 5 つの要素があります。配列要素の数が 3(<ArrayElementCount> 要素で指定された値)よりも大きいため、次のエラーが発生します。

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded array element count
    at line 3
    

解像度

JSONThreatProtection ポリシーで、ペイロードに含まれる配列カウントは特定のしきい値を超えてはならないと定められている場合、エラー メッセージが表示されると予想されます。この場合、追加のアクションは必要ありません。

ただし、配列内の要素の数がさらに多くても許容できると判断した場合は、要件に応じて <ArrayElementCount> を適切な値に変更します。

たとえば、最大 5 つの配列要素を許容できると判断した場合は、ポリシーを次のように変更します。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
    <DisplayName>JSON Threat Protection-1</DisplayName>
    <Properties/>
    <ArrayElementCount>5</ArrayElementCount>
    <ContainerDepth>12</ContainerDepth>
    <ObjectEntryCount>5</ObjectEntryCount>
    <ObjectEntryNameLength>6</ObjectEntryNameLength>
    <Source>request</Source>
    <StringValueLength>50</StringValueLength>
</JSONThreatProtection>

コンテナ深度の超過

エラー レスポンスの本文

ランタイム トラフィックは、次のエラーとともに 500 レスポンス コードを返します。

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Execution failed. reason: JSONThreatProtection[policy_name]:
          Exceeded container depth at line line-num",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

エラー レスポンスの本文の例

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]:
          Execution failed. reason: JSONThreatProtection[JSON-Threat-Protection-1]:
          Exceeded container depth at line 5",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

原因

このエラーは、<Source> 要素で指定された入力メッセージ ペイロードに含まれる JSON オブジェクトの JSON 要素のコンテナ深度が、ポリシーの <ContainerDepth> 要素で指定されたコンテナの最大深度を超える場合に発生します。コンテナ深度は、JSON 要素でネストされている最大許容深度です。たとえば、配列にオブジェクトが含まれていて、そのオブジェクトにさらにオブジェクトが含まれている場合、コンテナ深度は 3 になります。

たとえば、<ContainerDepth> 要素が 3 であるのに、入力ペイロードのコンテナ深度がこの上限を超える場合は、このエラーがスローされます。

診断

  1. エラー メッセージを調べて、JSONThreatProtection ポリシー名とコンテナ深度が超過している行番号を特定します。たとえば、次のエラー メッセージでは、ポリシー名は JSON-Threat-Protection-1、ペイロードの行番号は 5 です。

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded container depth at
    line 5
    
  2. <ContainerDepth> 要素で指定された値(手順 1 で特定した値)をメモしておきます。

    次の JSONThreatProtection ポリシーの例では、<ContainerDepth>5 に設定されています。

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
        <DisplayName>JSON Threat Protection-1</DisplayName>
        <Properties/>
        <ArrayElementCount>3</ArrayElementCount>
        <ContainerDepth>5</ContainerDepth>
        <ObjectEntryCount>5</ObjectEntryCount>
        <ObjectEntryNameLength>20</ObjectEntryNameLength>
        <Source>request</Source>
        <StringValueLength>50</StringValueLength>
    </JSONThreatProtection>
    
  3. 入力ペイロードの特定の行番号(手順 1 で特定した値)を調べて、ペイロードのコンテナ深度が <ContainerDepth> 要素で指定された値(手順 2 で特定した値)よりも大きいかどうかを確認します。コンテナ深度が数字を超えている場合は、それがエラーの原因です。

    入力ペイロードの例を次に示します。

    {
     "ContainerDepth2":[ {
           "ContainerDepth4":[
              {
                 "ContainerDepth6":[
                    "1",
                    "2"
                 ]
              }
           ]
        }
     ]
    }
    

    上記の JSON ペイロードのコンテナ深度は 5 行目の 6 です。深度が JSONThreatProtection ポリシーの <ContainerDepth> 要素に指定された 5 より大きいため、次のエラーが返されます。

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded container depth at
    line 5
    

解像度

JSONThreatProtection ポリシーで、ペイロードのコンテナ深度は指定された値を超えてはならないと定められている場合、エラー メッセージが表示されると予想されます。この場合、追加のアクションは必要ありません。

ただし、さらに深いコンテナ深度でも許容できると判断した場合は、要件に応じて <ContainerDepth> を適切な値に変更します。

たとえば、コンテナ深度を最大 10 まで許容できると判断した場合は、次のようにポリシーを変更します。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
    <DisplayName>JSON Threat Protection-1</DisplayName>
    <Properties/>
    <ArrayElementCount>3</ArrayElementCount>
    <ContainerDepth>10</ContainerDepth>
    <ObjectEntryCount>5</ObjectEntryCount>
    <ObjectEntryNameLength>20</ObjectEntryNameLength>
    <Source>request</Source>
    <StringValueLength>50</StringValueLength>
</JSONThreatProtection>

文字列値の長さの超過

エラー レスポンスの本文

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Execution failed. reason: JSONThreatProtection[policy_name]:
          Exceeded string value length at line line-num",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

エラー レスポンスの本文の例

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]:
          Execution failed. reason: JSONThreatProtection[JSON-Threat-Protection-1]:
          Exceeded string value length at line 3",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

原因

このエラーは、<Source> 要素で指定された入力メッセージ ペイロードに、<StringValueLength> 要素で許可された数よりも文字数が多い JSON 要素が含まれている場合に発生します。

たとえば、ポリシーで <StringValueLength> 要素が 50 に設定されているのに、入力ペイロードに 50 文字を超える要素が 1 つ以上含まれる場合、このエラーが発生します。

診断

  1. エラー メッセージを調べて、ポリシー名と文字列の長さが超過している行番号を特定します。次の例では、ポリシー名は JSON-Threat-Protection-1 and、ペイロードの行番号は 3 です。

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded string value length at line 3
    
  2. <StringValueLength> 要素で指定した値(手順 1 で特定した値)をメモします。

    次の JSONThreatProtection ポリシーの例では、<StringValueLength>50 に設定されています。

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
        <DisplayName>JSON Threat Protection-1</DisplayName>
        <Properties/>
        <ArrayElementCount>3</ArrayElementCount>
        <ContainerDepth>5</ContainerDepth>
        <ObjectEntryCount>5</ObjectEntryCount>
        <ObjectEntryNameLength>20</ObjectEntryNameLength>
        <Source>request</Source>
        <StringValueLength>50</StringValueLength>
    </JSONThreatProtection>
    
  3. 入力ペイロードの特定の行番号(手順 1 で特定した値)を調べ、長さの値が <StringValueLength> 要素で指定された文字数(手順 2 で特定した値)より大きいかどうかを確認します。長さの数値が上限を超えている場合、それがエラーの原因です。

    入力ペイロードの例を次に示します。

    {
      "Country": "New Zealand",
      "Place Name": "Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu"
    }
    

    上記の JSON ペイロードには、3 行目に Place Name という名前のオブジェクトがあり、その値 Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu は 85 文字です。長さが <StringValueLength> 要素で指定された値の 50 より大きいため、次のエラーが返されます。

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded string value length
    at line 3
    

解像度

JSONThreatProtection ポリシーで、ペイロードの値は特定の文字列長を超えてはならないと定められている場合、エラー メッセージが表示されると予想されます。この場合、追加のアクションは必要ありません。

ただし、ペイロードでさらに長い値を指定できると判断した場合は、要件に応じて <StringValueLength> を適切な値に変更します。

たとえば、最大 90 の長さを許容できると判断した場合は、次のようにポリシーを変更します。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
    <DisplayName>JSON Threat Protection-1</DisplayName>
    <Properties/>
    <ArrayElementCount>3</ArrayElementCount>
    <ContainerDepth>5</ContainerDepth>
    <ObjectEntryCount>5</ObjectEntryCount>
    <ObjectEntryNameLength>20</ObjectEntryNameLength>
    <Source>request</Source>
    <StringValueLength>90</StringValueLength>
</JSONThreatProtection>

JSON オブジェクトが有効でない

エラー レスポンスの本文

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Execution failed. reason: string: at line line-num",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

エラー レスポンスの本文の例

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]:
          Execution failed. reason: Expecting : at line 3",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

原因

このエラーは、JSONThreatProtection ポリシーの <Source> 要素で指定された入力メッセージ ペイロードが、有効な JSON オブジェクトではない場合に発生します。

診断

  1. エラー メッセージを調べて、エラーが発生したポリシー名と行番号を特定します。次の例では、ポリシー名は JSON-Threat-Protection-1 and、ペイロードの行番号は 2 です。

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason: Expecting : at line 3
    
  2. 入力ペイロードの特定の行番号(手順 1 で特定した値)を調べて、ペイロードに渡された JSON オブジェクトが実際に有効な JSON オブジェクトであるかどうかを確認します。

    入力ペイロードの例を次に示します。

    {
      "Longitude": 6.11499,
      "Latitude"  50.76891
    }
    

    上記の JSON ペイロードでは、行 3 には ":"(コロン)がありません。有効な JSON オブジェクトではないため、次のエラーが返されます。

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    Expecting : at line 3
    

解像度

JSONThreatProtection ポリシーを含む API プロキシに有効な入力 JSON ペイロードを確実に渡します。

上記の例では、次のように JSON ペイロードを変更します。

{
    "Longitude": 6.11499,
  "Latitude" : 50.76891
}

SourceUnavailable

エラーコード

steps.jsonthreatprotection.SourceUnavailable

エラー レスポンスの本文

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]::
          Source[var_name] is not available"
        "detail": {
            "errorcode": "steps.jsonthreatprotection.SourceUnavailable"
        }
    }
}

エラー レスポンスの本文の例

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]::
          Source requests is not available",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.SourceUnavailable"
        }
    }
}

原因

このエラーは、JSONThreatProtection ポリシーの <Source> 要素で指定された message 変数が、次のいずれかである場合に発生します。

  • 範囲外(ポリシーが実行されている特定のフローで使用できない)
  • 有効な値(requestresponsemessage)のいずれでもない

たとえば、ポリシーの <Source> 要素がポリシーが実行されるフローに存在しない変数に設定されている場合、このエラーが発生します。

診断

  1. ポリシーの名前と、エラー メッセージの Source 変数の名前を確認します。たとえば、次のエラー メッセージでは、ポリシー名は JSON-Threat-Protection-1、Source 変数は requests です。

    JSONThreatProtection[JSON-Threat-Protection-1]:: Source requests is not available
    
  2. 手順 1 で特定した <Source> 要素に指定された値を調べます。

    次の JSONThreatProtection ポリシーの例では、<Source> 要素は requests に設定されています。

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
        <DisplayName>JSON Threat Protection-1</DisplayName>
        <Properties/>
        <ArrayElementCount>3</ArrayElementCount>
        <ContainerDepth>5</ContainerDepth>
        <ObjectEntryCount>5</ObjectEntryCount>
        <ObjectEntryNameLength>20</ObjectEntryNameLength>
        <Source>requests</Source>
        <StringValueLength>50</StringValueLength>
    </JSONThreatProtection>
    

    <Source> 要素の有効な値は requestresponsemessage のいずれかです。リクエストが有効な値ではなく、ポリシーが実行されるフローに存在しないため、次のエラーが発生します。

    JSONThreatProtection[JSON-Threat-Protection-1]:: Source requests is not available
    

解像度

失敗した JSONThreatProtection ポリシーの <Source> 要素に設定された変数が requestresponsemessage のいずれかに設定されており、ポリシーが実行されるフローに存在することを確認します。

上記の JSONThreatProtection ポリシーの例を修正するには、request 変数がリクエスト フローに存在するので、その変数を使用するように <Source> 要素を変更します。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
    <DisplayName>JSON Threat Protection-1</DisplayName>
    <Properties/>
    <ArrayElementCount>3</ArrayElementCount>
    <ContainerDepth>5</ContainerDepth>
    <ObjectEntryCount>5</ObjectEntryCount>
    <ObjectEntryNameLength>20</ObjectEntryNameLength>
    <Source>request</Source>
    <StringValueLength>50</StringValueLength>
</JSONThreatProtection>

NonMessageVariable

エラーコード

steps.jsonthreatprotection.NonMessageVariable

エラー レスポンスの本文

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Variable var_name does not resolve to a Message"
        "detail": {
            "errorcode": "steps.jsonthreatprotection.NonMessageVariable"
        }
    }
}

エラー レスポンスの本文の例

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]:
          Variable message.content does not resolve to a Message",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.NonMessageVariable"
        }
    }
}

原因

このエラーは、JSONThreatProtection ポリシーの <Source> 要素がメッセージ型ではない変数に設定されている場合に発生します。

メッセージ型の変数は HTTP リクエストとレスポンス全体を表します。組み込みの Apigee Edge フロー変数のリクエスト、レスポンス、メッセージはメッセージ型です。メッセージ変数の詳細については、変数リファレンスをご覧ください。

診断

  1. エラー メッセージから JSONThreatProtection のポリシー名と Source 変数の名前を特定します。たとえば、次のエラー メッセージでは、ポリシー名は JSON-Threat-Protection-1、Source 変数は message.content です。

    JSONThreatProtection[JSON-Threat-Protection-1]: Variable message.content does not resolve to a Message
    
  2. JSONThreatProtection ポリシーの <Source> 要素(手順 1 で特定した値)を調べます。

    次の JSONThreatProtection ポリシーの例では、<Source>message ではなく message.content に設定されています。

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
        <DisplayName>JSON Threat Protection-1</DisplayName>
        <Properties/>
        <ArrayElementCount>3</ArrayElementCount>
        <ContainerDepth>5</ContainerDepth>
        <ObjectEntryCount>5</ObjectEntryCount>
        <ObjectEntryNameLength>20</ObjectEntryNameLength>
        <Source>message.content</Source>
        <StringValueLength>50</StringValueLength>
    </JSONThreatProtection>
    

    message.content はメッセージ型ではないため、次のエラーが発生します。

    JSONThreatProtection[JSON-Threat-Protection-1]: Variable message.content does
    not resolve to a Message
    

解決策

失敗した JSONThreatProtection ポリシーの <Source> 要素が、ポリシーが実行されるフローに存在するメッセージ型のフロー変数に設定されていることを確認します。

ポリシーを修正するには、<Source> 要素を変更して、メッセージ型の変数を指定します。たとえば、失敗した JSONThreatProtection では、<Source> 要素を message と指定できます。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
    <DisplayName>JSON Threat Protection-1</DisplayName>
    <Properties/>
    <ArrayElementCount>3</ArrayElementCount>
    <ContainerDepth>5</ContainerDepth>
    <ObjectEntryCount>5</ObjectEntryCount>
    <ObjectEntryNameLength>20</ObjectEntryNameLength>
    <Source>message</Source>
    <StringValueLength>50</StringValueLength>
</JSONThreatProtection>