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

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

InvalidQuotaInterval

錯誤訊息

透過 Apigee UI 或 API 部署 API Proxy 時失敗,並顯示以下錯誤訊息:

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.

螢幕截圖範例

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

原因

如果配額政策的 <Interval> 元素中指定的配額間隔不是整數,API Proxy 的部署作業就會失敗。

舉例來說,如果在配額政策的 <Interval> 元素中指定的配額間隔為 0.1,則 API Proxy 的部署作業會失敗。

診斷

  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 Proxy 的部署作業會失敗,並顯示以下錯誤:

    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

錯誤訊息

透過 Apigee UI 或 API 部署 API Proxy 時失敗,並顯示以下錯誤訊息:

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.

螢幕截圖範例

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

原因

如果系統不支援配額政策 <TimeUnit> 元素中指定的時間單位,API 代理程式就無法部署。

支援的時間單位為 minutehourdayweekmonth

舉例來說,如果在配額政策的 <TimeUnit> 元素中,將時間單位指定為 year,則 API Proxy 的部署作業會失敗。

診斷

  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 Proxy 的部署作業會失敗,並顯示以下錯誤:

    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

錯誤訊息

透過 Apigee UI 或 API 部署 API Proxy 時失敗,並顯示以下錯誤訊息:

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.

螢幕截圖範例

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

原因

如果配額政策的 <Quota> 元素中 type 屬性指定的配額類型無效,則 API Proxy 的部署作業會失敗。

支援的配額類型為 defaultcalendarflexirollingwindow

舉例來說,如果在配額政策的 <Quota> 元素中,政策類型指定為 window,則 API Proxy 的部署作業會失敗。

診斷

  1. 找出配額政策中使用的無效配額類型。您可以在錯誤訊息中找到這項資訊。舉例來說,在下列錯誤中,無效的政策類型為 window

    Error Saving Revision 1
    No enum constant com.apigee.quota.types.QuotaType.window.
    
  2. 檢查發生失敗的特定 API Proxy 中的所有配額政策。如果有任何配額政策,其中 <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>
    

    由於 type 屬性設為 window (系統不支援),因此 API Proxy 部署作業會失敗,並顯示以下錯誤訊息:

    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

錯誤訊息

透過 Apigee UI 或 API 部署 API Proxy 時失敗,並顯示以下錯誤訊息:

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.

螢幕截圖範例

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

原因

如果配額政策的 <StartTime> 元素中指定的時間格式無效,API proxy 的部署作業就會失敗。

有效格式為 yyyy-MM-dd HH:mm:ss,也就是 ISO 8601 日期和時間格式。

舉例來說,如果配額政策的 <StartTime> 元素中指定的時間為 7-16-2017 12:00:00,則 API Proxy 的部署作業會失敗。

診斷

  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 Proxy 中的所有配額政策。如果有任何配額政策,其中 <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 Proxy 的部署作業會失敗,並顯示以下錯誤訊息:

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

解決方法

請確認配額政策的 <StartTime> 元素中指定的開始時間格式符合規定格式 yyyy-MM-dd HH:mm:ss。例如:

<?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

錯誤訊息

透過 Apigee UI 或 API 部署 API Proxy 時失敗,並顯示以下錯誤訊息:

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.

螢幕截圖範例

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

原因

如果在配額政策中指定的 <StartTime> 元素配額類型並非日曆類型,API Proxy 的部署作業就會失敗。

<StartTime> 元素僅支援 calendar 配額類型。

舉例來說,如果在配額政策的 <Quota> 元素中將 type 屬性設為 flexirolling window,則 API Proxy 的部署作業會失敗。

診斷

  1. 找出在失敗配額政策中指定的配額類型。您可以在錯誤訊息中找到這項資訊。舉例來說,在以下錯誤中,無效的開始時間為 flexi

    Starttime is not supported for quotatype flexi. Starttime is
    supported only for calendar based type.
    
  2. 檢查發生失敗的特定 API Proxy 中的所有配額政策。如果任何配額政策的 type 屬性與上述步驟 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>
    

    由於配額政策中的配額類型已指定為 flexi,因此 <StartTime> 元素會在該政策中指定,導致 API Proxy 部署失敗,並顯示以下錯誤訊息:

    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

錯誤訊息

透過 Apigee UI 或 API 部署 API Proxy 時失敗,並顯示以下錯誤訊息:

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

錯誤訊息示例

Error Saving Revision 1
Invalid timeunit second for distributed quota.

螢幕截圖範例

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

原因

如果 <Distributed> 元素設為 true,而 <TimeUnit> 元素設為 second,則 API Proxy 的部署作業會失敗。時間單位 second 不適用於分散配額。

Distributed 元素設為 true 時,政策應維持中央計數器,並持續在所有訊息處理器之間同步。因此,在短時間內 (例如幾秒) 內,很難同步處理並驗證要求數量是否未超過指定配額。因此,在分散配額的情況下,時間單位 second 會視為無效。

診斷

檢查發生失敗的特定 API Proxy 中的所有配額政策。如果任何配額政策的 <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

錯誤訊息

透過 Apigee UI 或 API 部署 API Proxy 時失敗,並顯示以下錯誤訊息:

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.

螢幕截圖範例

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

原因

如果在配額政策的 <AsynchronousConfiguration> 元素中,為 <SyncIntervalInSeconds> 元素指定的值小於零,則 API Proxy 的部署作業會失敗。

診斷

檢查發生失敗的特定 API Proxy 中的所有配額政策。如果任何配額政策中的 <SyncIntervalInSeconds> 元素在 <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>-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

錯誤訊息

透過 Apigee UI 或 API 部署 API Proxy 時失敗,並顯示以下錯誤訊息:

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

錯誤訊息示例

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

螢幕截圖範例

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

原因

如果在配額政策中將 <Synchronous> 元素的值設為 true,且該政策也使用 <AsynchronousConfiguration> 元素定義非同步設定,則 API Proxy 的部署作業會失敗。

診斷

檢查發生失敗的特定 API Proxy 中的所有配額政策。如果有任何配額政策將 <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>