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

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

InvalidQuotaInterval

錯誤訊息

無法透過 Edge UI 或 Edge Management 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.

螢幕截圖範例

原因

如果配額政策的 <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

錯誤訊息

無法透過 Edge UI 或 Edge Management 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.

螢幕截圖範例

原因

如果配額政策的 <TimeUnit> 元素中指定的時間單位不受支援,API Proxy 部署就會失敗。

支援的時間單位為 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

錯誤訊息

無法透過 Edge UI 或 Edge Management 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.

螢幕截圖範例

原因

如果配額政策的 <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

錯誤訊息

無法透過 Edge UI 或 Edge Management 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.

螢幕截圖範例

原因

如果配額政策的 <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

錯誤訊息

無法透過 Edge UI 或 Edge Management 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.

螢幕截圖範例

原因

如果配額政策中指定的 <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 中的所有配額政策。如有任何配額政策指定的類型屬性與上述步驟 #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 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

錯誤訊息

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

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

錯誤訊息

無法透過 Edge UI 或 Edge Management 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.

螢幕截圖範例

原因

如果在配額政策的 <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

錯誤訊息

無法透過 Edge UI 或 Edge Management 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.

螢幕截圖範例

原因

如果配額政策中的 <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>