重設配額政策部署錯誤疑難排解

您正在查看 Apigee Edge 說明文件。
查看 Apigee X 說明文件
資訊

InvalidCount

錯誤訊息

無法透過 Edge UI 或 Edge Management API 部署 API Proxy,並顯示以下錯誤訊息:

Error Saving Revision revision_number
Invalid count value interval for identifier identifier_name in policy_name.

錯誤訊息示例

Error Saving Revision 1
Invalid count value 10.0 for identifier identifierName in Reset_Quota_Demo.

螢幕截圖範例

原因

如果重設配額政策的 <Allow> 元素中指定的計數值不是整數,API Proxy 部署就會失敗。

舉例來說,如果 <Allow> 元素中指定的配額間隔為 10.0,API Proxy 的部署就會失敗。

診斷

  1. 找出發生錯誤的重設配額政策,以及無效的允許數量。您可以在錯誤訊息中找到這項資訊。舉例來說,在以下錯誤中,政策名稱為 Reset_Quota_Demo,無效的允許計數為 10.0

    Error Saving Revision 1
    Invalid count value 10.0 for identifier identifierName in Reset_Quota_Demo.
    
  2. 驗證失敗政策中指定的允許計數值與錯誤訊息中指出的值 (如上方的步驟 1) 相符。例如,下列政策將允許計數的值指定為 10.0,此值與錯誤訊息中的內容相符:

    <ResetQuota async="false" continueOnError="false" enabled="true" name="Reset_Quota_Demo">
        <DisplayName>Reset_Quota_Demo</DisplayName>
        <Properties/>
        <Quota>
            <Identifier name="identifierName" ref="request.header.identifier">
                <Allow>10.0</Allow>
            </Identifier>
        </Quota>
    </ResetQuota>
    

    在上述的「重設配額政策」範例中,允許計數的值是 10.0,該值不是整數。因此,API Proxy 的部署失敗並出現以下錯誤:

    Invalid count value 10.0 for identifier identifierName in Reset_Quota_Demo.
    

解析度

確認重設配額政策的 <Allow> 元素中指定的允許計數值是整數。如要修正上方顯示的 ResetQuota 政策範例,您可以將 元素修改為值為 10

<ResetQuota async="false" continueOnError="false" enabled="true" name="Reset_Quota_Demo">
    <DisplayName>Reset_Quota_Demo</DisplayName>
    <Properties/>
    <Quota>
        <Identifier name="identifierName" ref="request.header.identifier">
            <Allow>10</Allow>
        </Identifier>
    </Quota>
</ResetQuota>