ResetQuota 政策部署错误问题排查

您正在查看的是 Apigee Edge 文档。
转到 Apigee X 文档
信息

InvalidCount

错误消息

通过 Edge 界面或 Edge Management API 部署 API 代理失败,并显示以下错误消息:

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 代理的部署将失败。

例如,如果在 <Allow> 元素中指定的配额间隔为 10.0,则 API 代理的部署将失败。

诊断

  1. 标识发生错误的 ResetQuota 政策以及无效的允许计数。您可以从错误消息中找到此信息。例如,在以下错误中,政策名称为 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>
    

    在上面显示的“ResetQuota 政策”示例中,允许计数的值是 10.0,但不是整数。因此,API 代理的部署失败并显示以下错误:

    Invalid count value 10.0 for identifier identifierName in Reset_Quota_Demo.
    

分辨率

确保 ResetQuota 政策的 <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>