配额政策部署错误问题排查

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

InvalidQuotaInterval

错误消息

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

Error Saving Revision [revision_number]
Invalid quota interval [interval] in quota policy [policy_name].

错误消息示例

Error Saving Revision 1
Invalid quota interval 0.1 in quota policy Quota-1.

示例屏幕截图

原因

如果在配额政策的 <Interval> 元素中指定的配额间隔不是整数,则 API 代理的部署将失败。

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

诊断

  1. 标识发生错误的配额政策以及无效的配额间隔。您可以从错误消息中找到此信息。例如,在以下错误中,政策名称为 Quota-1,无效配额间隔为 0.1

    Error Saving Revision 1
    Invalid quota interval 0.1 in quota policy Quota-1.
    
  2. 验证失败配额政策中指定的配额间隔值是否与错误消息中标识的值匹配(上文中的第 1 步)。例如,以下政策会将配额间隔的值指定为 0.1,这与错误消息中的内容匹配:

    <Quota async="false" continueOnError="false" enabled="true" name="Quota-1">
     <DisplayName>Quota-1</DisplayName>
     <Properties />
     <Allow count="3" />
     <Interval>0.1</Interval>
     <TimeUnit>minute</TimeUnit>
    </Quota>
    
  3. 如果指定的配额间隔不是整数,那么这就是错误的原因。

    在上面显示的示例配额政策中,配额间隔值为 0.1,并非整数。因此,API 代理的部署失败并显示以下错误:

    Invalid quota interval 0.1 in quota policy Quota-1.
    

解决方法

确保在配额政策的 <Interval> 元素中指定的配额间隔的值是整数。例如:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota async="false" continueOnError="false" enabled="true" name="Quota-1">
    <DisplayName>Quota-1</DisplayName>
    <Properties/>
    <Allow count="3"/>
    <Interval>1</Interval>
    <TimeUnit>minute</TimeUnit>
</Quota>

InvalidQuotaTimeUnit

错误消息

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

Error Saving Revision [revision_number]
Invalid quota interval time unit [time_unit] in quota policy
[policy_name] in Revision [revision_number] of application
[proxy_name], in organization [org_name].

错误消息示例

Error Saving Revision 1
Invalid quota interval time unit year in quota policy Quota-1 in Revision 1 of application Quota_test, in organization aprabhashankar-eval.

示例屏幕截图

原因

如果在配额政策的 <TimeUnit> 元素中指定的时间单位不受支持,则 API 代理的部署将失败。

支持的时间单位包括 minutehourdayweekmonth

例如,如果在配额政策的 <TimeUnit> 元素中将时间单位指定为 year,则 API 代理的部署将失败。

诊断

  1. 指出发生错误的配额政策以及无效的时间单位。您可以从错误消息中找到此信息。例如,在以下错误中,政策名称为 Quota-1,无效时间单位为 year

    Invalid quota interval time unit year in quota policy Quota-1
    in Revision 1 of application Quota_test, in organization aprabhashankar-eval.
    
  2. 验证配额政策的 <TimeUnit> 元素中指定的时间单位与错误消息中指定的时间单位匹配(上文中的第 1 步)。例如,以下政策会将配额间隔的值指定为 year,这与错误消息中的内容匹配:

    <Quota async="false" continueOnError="false" enabled="true" name="Quota-1">
     <DisplayName>Quota-1</DisplayName>
     <Properties />
     <Allow count="3" />
     <Interval>1</Interval>
     <TimeUnit>year</TimeUnit>
    </Quota>
    
  3. 如果配额政策中指定的时间单位不受支持,那么这就是错误的原因。

    在上面显示的示例配额政策中,时间单位被指定为不受支持的 year。因此,API 代理的部署失败并显示以下错误:

    Invalid quota interval time unit year in quota policy Quota-1 in Revision 1 of application Quota_test, in organization aprabhashankar-eval.
    

分辨率

确保支持配额政策的 <TimeUnit> 元素中指定的时间单位。例如:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota async="false" continueOnError="false" enabled="true" name="Quota-1">
    <DisplayName>Quota-1</DisplayName>
    <Properties/>
    <Allow count="3"/>
    <Interval>1</Interval>
    <TimeUnit>month</TimeUnit>
</Quota>

InvalidQuotaType

错误消息

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

Error Saving Revision [revision_number]
No enum constant com.apigee.quota.types.QuotaType.[type].

错误消息示例

Error Saving Revision 1
No enum constant com.apigee.quota.types.QuotaType.window.

示例屏幕截图

原因

如果配额政策的 <Quota> 元素中的 type 属性指定的配额类型无效,则 API 代理的部署将失败。

支持的配额类型包括 defaultcalendarflexirollingwindow

例如,如果在配额政策的 <Quota> 元素中政策类型被指定为 window,则 API 代理的部署将失败。

诊断

  1. 标识配额政策中使用的无效配额类型。您可以从错误消息中找到此信息。例如,在以下错误中,无效的政策类型为 window

    Error Saving Revision 1
    No enum constant com.apigee.quota.types.QuotaType.window.
    
  2. 检查出现故障的特定 API 代理中的所有配额政策。如果在 <Quota> 元素中指定的配额类型与上面的第 1 步中指定的不受支持的类型匹配,则为错误的原因。

    例如,以下政策将类型指定为 window,它与错误消息中的内容匹配:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Quota async="false" continueOnError="false" enabled="true" name="Quota-1" type="window">
        <DisplayName>Quota-1</DisplayName>
        <Properties/>
        <Allow count="3"/>
        <Interval>1</Interval>
        <TimeUnit>minute</TimeUnit>
        <StartTime>2017-7-16 12:00:00</StartTime>
        <MessageWeight ref="messageWeight"/>
    </Quota>
    

    由于不支持将类型属性设置为 window,因此 API 代理的部署将失败并显示以下错误:

    No enum constant com.apigee.quota.types.QuotaType.window.
    

分辨率

确保支持配额政策的 <Quota> 元素中的 type 属性指定的配额类型。例如:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota async="false" continueOnError="false" enabled="true" name="Quota-1" type="rollingwindow">
    <DisplayName>Quota-1</DisplayName>
    <Properties/>
    <Allow count="3"/>
    <Interval>1</Interval>
    <TimeUnit>minute</TimeUnit>
    <StartTime>2017-7-16 12:00:00</StartTime>
    <MessageWeight ref="messageWeight"/>
</Quota>

InvalidStartTime

错误消息

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

Error Saving Revision [revision_number]
Invalid Starttime:[start_time]; Start Time should be of the format yyyy-MM-dd HH:mm:ss.

错误消息示例

Error Saving Revision 1
Invalid Starttime:7-16-2017 12:00:00; Start Time should be of the format yyyy-MM-dd HH:mm:ss.

示例屏幕截图

原因

如果配额政策的 <StartTime> 元素中指定的时间格式无效,则 API 代理的部署将失败。

有效格式为 yyyy-MM-dd HH:mm:ss,这是 ISO 8601 日期和时间格式。

例如,如果配额政策的 <StartTime> 元素中指定的时间为 7-16-2017 12:00:00,则 API 代理的部署将失败。

诊断

  1. 标识配额政策中指定的无效开始时间。您可以从错误消息中找到此信息。例如,在以下错误中,无效的开始时间为 7-16-2017 12:00:00

    Invalid Starttime:7-16-2017 12:00:00; Start Time should be of the format yyyy-MM-dd HH:mm:ss.
    
  2. 检查出现故障的特定 API 代理中的所有配额政策。如果有任何配额政策,其中 <StartTime> 元素中指定的值与上述第 1 步中指定的无效的开始时间匹配,则这就是错误的原因。

    例如,以下政策将类型指定为 7-16-2017 12:00:00,它与错误消息中的内容匹配:

    <?xml version="1.0" encoding="UTF-8"?>
    <Quota async="false" continueOnError="false" enabled="true" name="Quota-1" type="calendar">
       <DisplayName>Quota-1</DisplayName>
       <Properties />
       <Allow count="3" />
       <Interval>1</Interval>
       <TimeUnit>minute</TimeUnit>
       <StartTime>7-16-2017 12:00:00</StartTime>
    </Quota>
    

    由于为 <StartTime> 设置的值被设置为不符合规定的日期/时间格式的 7-16-2017 12:00:00,因此 API 代理的部署失败并显示以下错误:

    Invalid Starttime:7-16-2017 12:00:00; Start Time should be of the format yyyy-MM-dd HH:mm:ss.
    

分辨率

确保根据所需格式 yyyy-MM-dd HH:mm:ss,配额政策的 <StartTime> 元素中指定的开始时间格式有效。例如:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota async="false" continueOnError="false" enabled="true" name="Quota-1" type="calendar">
    <DisplayName>Quota-1</DisplayName>
    <Properties/>
    <Allow count="3"/>
    <Interval>1</Interval>
    <TimeUnit>minute</TimeUnit>
    <StartTime>2017-7-16 12:00:00</StartTime>
</Quota>

StartTimeNotSupported

错误消息

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

Error Saving Revision [revision_number]
Starttime is not supported for quotatype [quota_type]. Starttime is supported only for calendar based type.

错误消息示例

Error Saving Revision 1
Starttime is not supported for quotatype flexi. Starttime is supported only for calendar based type.

示例屏幕截图

原因

如果在配额政策中指定的 <StartTime> 元素的配额类型并非日历类型,则 API 代理的部署将失败。

calendar 配额类型支持 <StartTime> 元素。

例如,如果在配额政策的 <Quota> 元素中将 type 属性设为 flexirolling window,则 API 代理的部署将失败。

诊断

  1. 标识失败配额政策中指定的配额类型。您可以从错误消息中找到此信息。例如,在以下错误中,无效的开始时间为 flexi

    Starttime is not supported for quotatype flexi. Starttime is
    supported only for calendar based type.
    
  2. 检查出现故障的特定 API 代理中的所有配额政策。如果存在任何配额政策,其中指定的类型属性与上述第 1 步中标识的配额类型相匹配,并且指定了 <StartTime> 元素,则这就是错误的原因。

    例如,以下政策将配额类型指定为 flexi,这与错误消息中的内容相匹配,并且也指定了 <StartTime> 元素:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Quota async="false" continueOnError="false" enabled="true" name="Quota-1" type="flexi">
        <DisplayName>Quota-1</DisplayName>
        <Properties/>
        <Allow count="3"/>
        <Interval>1</Interval>
        <TimeUnit>minute</TimeUnit>
        <StartTime>2017-7-16 12:00:00</StartTime>
    </Quota>
    

    由于配额政策中指定了 <StartTime> 元素,并且其配额类型指定为 flexi,因此 API 代理的部署失败并显示以下错误:

    Starttime is not supported for quotatype flexi. Starttime is supported only for calendar based type.
    

分辨率

确保在 <Quota> 元素中的 type 属性指示的配额类型是 flexirolling window 时,<StartTime> 元素未指定。例如:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota async="false" continueOnError="false" enabled="true" name="Quota-1" type="flexi">
    <DisplayName>Quota-1</DisplayName>
    <Properties/>
    <Allow count="3"/>
    <Interval>1</Interval>
    <TimeUnit>minute</TimeUnit>
</Quota>

InvalidTimeUnitForDistributedQuota

错误消息

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

Error Saving Revision [revision number]
Invalid timeunit second for distributed quota.

错误消息示例

Error Saving Revision 1
Invalid timeunit second for distributed quota.

示例屏幕截图

原因

如果将 <Distributed> 元素设置为 true 且将 <TimeUnit> 元素设置为 second,则 API 代理的部署将失败。时间单位 second 对于分布式配额无效。

Distributed 元素设置为 true 时,政策应保留一个中心计数器,并在所有消息处理器中持续对其进行同步。因此,将很难在短时间内(例如秒)同步并验证请求数未超过指定的配额。因此,对于分布式配额,时间单位 second 被认为是无效的。

诊断

检查出现故障的特定 API 代理中的所有配额政策。如果有任何配额政策,其 <TimeUnit> 元素设置为 second,且 <Distributed> 元素设置为 true,则这就是错误的原因。

例如,以下政策将 <TimeUnit> 元素设置为 second,且 <Distributed> 元素设置为 true

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota async="false" continueOnError="false" enabled="true" name="CheckQuota" type="calendar">
    <DisplayName>CheckQuota</DisplayName>
    <Properties/>
    <Allow count="30"/>
    <Interval>1</Interval>
    <TimeUnit>second</TimeUnit>
    <StartTime>2018-8-05 12:00:00</StartTime>
    <Distributed>true</Distributed>
    <Synchronous>false</Synchronous>
</Quota>

分辨率

<Distributed> 元素设为 true 时,切勿将 <TimeUnit> 元素设置为 second<TimeUnit> 元素可设置为任何其他允许的值,即 minute, hour, day, week,month。例如:

<Quota async="false" continueOnError="false" enabled="true" name="CheckQuota" type="calendar">
    <DisplayName>CheckQuota</DisplayName>
    <Properties/>
    <Allow count="30"/>
    <Interval>1</Interval>
    <TimeUnit>hour</TimeUnit>
    <StartTime>2018-8-05 12:00:00</StartTime>
    <Distributed>true</Distributed>
    <Synchronous>false</Synchronous>
</Quota>

InvalidSynchronizeIntervalForAsyncConfiguration

错误消息

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

Error Saving Revision [revision number]
SyncIntervalInSeconds should be a value greater than zero.

错误消息示例

Error Saving Revision 1
SyncIntervalInSeconds should be a value greater than zero.

示例屏幕截图

原因

如果在配额政策的 <AsynchronousConfiguration> 元素中为 <SyncIntervalInSeconds> 元素指定的值小于 0,则 API 代理的部署将失败。

诊断

检查出现故障的特定 API 代理中的所有配额政策。如果存在任何配额政策,其中在 <AsynchronousConfiguration> 元素中将 <SyncIntervalInSeconds> 元素设置为小于 0 的值,则这就是错误的原因。

例如,以下政策为 <SyncIntervalInSeconds> 元素指定了负值:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota async="false" continueOnError="false" enabled="true" name="Quota_AsyncConfig" type="calendar">
    <DisplayName>Quota_AsyncConfig</DisplayName>
    <Properties/>
    <Allow count="3"/>
    <Interval>1</Interval>
    <TimeUnit>minute</TimeUnit>
    <StartTime>2017-7-16 12:00:00</StartTime>
    <Distributed>true</Distributed>
    <Synchronous>false</Synchronous>
    <AsynchronousConfiguration>
        <SyncIntervalInSeconds>-1</SyncIntervalInSeconds>
    </AsynchronousConfiguration>
</Quota>

分辨率

务必始终在配额政策的 <AsynchronousConfiguration> 元素中为 <SyncIntervalInSeconds> 元素指定正整数。例如:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota async="false" continueOnError="false" enabled="true" name="Quota_AsyncConfig" type="calendar">
    <DisplayName>Quota_AsyncConfig</DisplayName>
    <Properties/>
    <Allow count="3"/>
    <Interval>1</Interval>
    <TimeUnit>minute</TimeUnit>
    <StartTime>2017-7-16 12:00:00</StartTime>
    <Distributed>true</Distributed>
    <Synchronous>false</Synchronous>
    <AsynchronousConfiguration>
        <SyncIntervalInSeconds>5</SyncIntervalInSeconds>
    </AsynchronousConfiguration>
</Quota>

InvalidAsynchronizeConfigurationForSynchronousQuota

错误消息

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

Error Saving Revision [revision number]
AsynchronousConfiguration is not valid for synchronous quota.

错误消息示例

Error Saving Revision 2
AsynchronousConfiguration is not valid for synchronous quota.

示例屏幕截图

原因

如果在配额政策中将 <Synchronous> 元素的值设置为 true,并且还使用 <AsynchronousConfiguration> 元素定义异步配置,则 API 代理的部署将失败。

诊断

检查出现故障的特定 API 代理中的所有配额政策。如果有任何配额政策(其中 <Synchronous> 元素设为 true),并且如果 <AsynchronousConfiguration> 元素也已定义,那么这就是错误的原因。

例如,以下政策的 <Synchronous> 元素设置为 true,还定义了 <AsynchronousConfiguration> 元素:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota async="false" continueOnError="false" enabled="true" name="Quota_AsyncConfig" type="calendar">
    <DisplayName>Quota_AsyncConfig</DisplayName>
    <Properties/>
    <Allow count="3"/>
    <Interval>1</Interval>
    <TimeUnit>minute</TimeUnit>
    <StartTime>2017-7-16 12:00:00</StartTime>
    <Distributed>true</Distributed>
    <Synchronous>true</Synchronous>
    <AsynchronousConfiguration>
     <SyncIntervalInSeconds>1</SyncIntervalInSeconds>
    </AsynchronousConfiguration>
</Quota>

分辨率

如果在配额政策中将 <Synchronous> 元素设置为 true,请确保没有使用 <AsynchronousConfiguration> 元素定义异步配置。

可以通过移除 <AsynchronousConfiguration> 部分来更正上述示例,如下所示:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Quota async="false" continueOnError="false" enabled="true" name="Quota_AsyncConfig" type="calendar">
    <DisplayName>Quota_AsyncConfig</DisplayName>
    <Properties/>
    <Allow count="3"/>
    <Interval>1</Interval>
    <TimeUnit>minute</TimeUnit>
    <StartTime>2017-7-16 12:00:00</StartTime>
    <Distributed>true</Distributed>
 <Synchronous>true</Synchronous>
</Quota>