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

您正在查看 ApigeeApigee Hybrid 說明文件。
查看 Apigee Edge 說明文件。

InvalidCount

錯誤訊息

透過 Apigee UI 或 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.

螢幕截圖範例

儲存修訂版本 1 時發生錯誤。

原因

如果「重設配額政策」的 <Allow> 元素中指定的計數值不是整數,則 API 代理程式會部署失敗。

舉例來說,如果在 <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>