할당량 런타임 오류 문제 해결

현재 Apigee Edge 문서가 표시되고 있습니다.
Apigee X 문서로 이동
정보

InvalidMessageWeight

오류 코드

policies.ratelimit.InvalidMessageWeight

오류 응답 본문

{
    "fault": {
        "faultstring": "Invalid message weight value [invalid_value]",
        "detail": {
            "errorcode": "policies.ratelimit.InvalidMessageWeight"
        }
    }
}

오류 메시지 예시

{
    "fault": {
        "faultstring": "Invalid message weight value 1.5",
        "detail": {
            "errorcode": "policies.ratelimit.InvalidMessageWeight"
        }
    }
}

원인

이 오류는 흐름 변수를 통해 지정된 <MessageWeight> 요소의 값이 잘못된 경우에(정수가 아닌 값) 발생합니다.

예를 들어 이 오류는 <MessageWeight> 요소에 지정된 흐름 변수의 값이 1.5이면(정수가 아닌 값) 발생합니다.

진단

  1. 할당량 정책의 <MessageWeight> 요소에 사용된 잘못된 값을 확인합니다. 이 정보는 오류 응답의 faultstring 요소에서 확인할 수 있습니다. 예를 들어 다음 오류에서 <MessageWeight> 요소에 사용된 잘못된 값은 1.5입니다.

    "faultstring": "Invalid message weight value 1.5"
    
  2. 오류가 발생한 특정 API 프록시의 모든 할당량 정책을 검사합니다. <MessageWeight> 요소가 지정된 할당량 정책이 하나 이상 있을 수 있습니다.

    예를 들어 다음 정책은 흐름 변수 message_weight를 통해 <MessageWeight>을 지정합니다.

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <Quota async="false" continueOnError="false" enabled="true" name="Quota_with_weight" type="calendar">
        <DisplayName>Quota_with_weight</DisplayName>
        <Properties/>
        <Allow count="3"/>
        <Interval>1</Interval>
        <TimeUnit>minute</TimeUnit>
        <StartTime>2017-7-16 12:00:00</StartTime>
        <MessageWeight ref="message_weight"/>
    </Quota>
    
  3. 식별된 할당량 정책에서 <MessageWeight>에 사용된 변수의 값을 확인합니다. 흐름 변수의 값은 HTTP 헤더, 쿼리 매개변수, XML 또는 JSON 요청 페이로드에서 추출하거나 다른 정책에서 정의할 수 있습니다.

    1. 변수가 먼저 정의된 API 프록시 번들 내에서 코드를 찾습니다.
    2. 변수가 먼저 정의되고 채워지는 정책을 확인한 후 변수의 값이 어떻게 설정되는지 확인합니다.
    3. 흐름 변수의 값이 위의 1단계에서 식별된 값과 일치한다면, 이는 오류의 원인이 됩니다.

    예를 들어 할당량 정책 전에 사용된 자바스크립트 정책이 다음과 같이 요청 유형에 따라 message_weight 변수를 설정한다고 가정합니다.

    var verb = context.getVariable("request.verb");
    context.setVariable("message_weight", "1.5");
    if (verb == 'POST') {
      context.setVariable("message_weight", "2");
    }
    

    여기서 변수 message_weight의 값은 1.5이며 잘못된 값(정수가 아님)입니다.

해상도

흐름 변수로 지정된 MessageWeight를 나타내는 값이 유효한 값(정수 값)인지 확인합니다.

위에 표시된 예시를 수정하려면 자바스크립트의 변수 message_weight 값을 정수로 수정하면 됩니다.

var verb = context.getVariable("request.verb");
context.setVariable("message_weight", "1");
if (verb == 'POST') {
  context.setVariable("message_weight", "2");
}

FailedToResolveQuotaIntervalReference

오류 코드

policies.ratelimit.FailedToResolveQuotaIntervalReference

오류 응답 본문

{
    "fault": {
        "faultstring": "Failed to resolve quota interval reference [reference] in quota policy {1}",
        "detail": {
            "errorcode": "policies.ratelimit.FailedToResolveQuotaIntervalReference"
        }
    }
}

오류 메시지 예시

{
    "fault": {
        "faultstring": "Failed to resolve quota interval reference api.product.developer.quota.interval in quota policy {1}",
        "detail": {
            "errorcode": "policies.ratelimit.FailedToResolveQuotaIntervalReference"
        }
    }
}

원인

이 오류는 할당량 정책에서 <Interval> 요소가 정의되지 않은 경우에 발생합니다. 이 요소는 필수이며 할당량에 적용되는 시간 간격을 지정하는 데 사용됩니다. 시간 간격은 <TimeUnit> 요소에 정의된 대로 분, 시간, 일, 주 또는 월 단위일 수 있습니다.

진단

  1. 오류가 발생한 API 프록시에 있는 각 할당량 정책을 확인합니다. 필수 요소 <Interval>이 정의되지 않은 할당량 정책이 있다면, 이는 오류의 원인이 됩니다.

    예를 들어 다음 할당량 정책에는 필수 요소 <Interval>이 없습니다.

    <?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="3"/>
            <TimeUnit ref="verifyapikey.verify-api-key.apiproduct.developer.quota.timeunit">hour</TimeUnit>
        <StartTime>2017-7-16 12:00:00</StartTime>
    </Quota>
    

    필수 요소 <TimeUnit>이 위의 할당량 정책에 정의되어 있지 않으므로 다음과 같은 오류 코드가 표시됩니다.

    policies.ratelimit.FailedToResolveQuotaIntervalReference
    

해상도

특정 API 프록시의 모든 할당량 정책에 필수 요소 <Interval>이 올바르게 정의되어 있는지 확인합니다.

위에 표시된 예시를 수정하려면 다음과 같이 <Interval> 요소를 포함하도록 정책을 수정할 수 있습니다.

<?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="3"/>
    <TimeUnit ref="verifyapikey.verify-api-key.apiproduct.developer.quota.timeunit">hour</TimeUnit>
    <Interval ref="verifyapikey.verify-api-key.apiproduct.developer.quota.interval">1</Interval>
    <StartTime>2017-7-16 12:00:00</StartTime>
</Quota>

FailedToResolveQuotaIntervalTimeUnitReference

오류 코드

policies.ratelimit.FailedToResolveQuotaIntervalTimeUnitReference

오류 응답 본문

{
    "fault": {
        "faultstring": "Failed to resolve quota time unit reference [reference] in quota policy {1}",
        "detail": {
            "errorcode": "policies.ratelimit.FailedToResolveQuotaIntervalTimeUnitReference"
        }
    }
}

오류 메시지 예시

{
    "fault": {
        "faultstring": "Failed to resolve quota time unit reference apiproduct.developer.quota.timeunity in quota policy {1}",
        "detail": {
            "errorcode": "policies.ratelimit.FailedToResolveQuotaIntervalTimeUnitReference"
        }
    }
}

원인

이 오류는 할당량 정책 내에 <TimeUnit> 요소가 정의되지 않은 경우에 발생합니다. 이 요소는 필수이며 할당량에 적용되는 시간 단위를 지정하는 데 사용됩니다. 시간 간격은 분, 시간, 일, 주 또는 월 단위일 수 있습니다.

진단

  1. 오류가 발생한 API 프록시에 있는 각 할당량 정책을 확인합니다. 필수 요소 <TimeUnit>이 정의되지 않은 할당량 정책이 있다면, 이는 오류의 원인이 됩니다.

    예를 들어 다음 할당량 정책에는 필수 요소 <TimeUnit>이 없습니다.

    <Quota async="false" continueOnError="false" enabled="true" name="CheckQuota" type="calendar">
      <DisplayName>CheckQuota</DisplayName>
      <Properties/>
      <Allow count="3"/>
          <Interval ref="verifyapikey.verify-api-key.apiproduct.developer.quota.interval">1</Interval>
      <StartTime>2017-7-16 12:00:00</StartTime>
    </Quota>
    

    필수 요소 <TimeUnit>이 위의 할당량 정책에 정의되어 있지 않으므로 다음과 같은 오류 코드가 표시됩니다.

    policies.ratelimit.FailedToResolveQuotaIntervalTimeUnitReference
    

해상도

특정 API 프록시의 모든 할당량 정책에 필수 요소 <TimeUnit>이 정의되어 있는지 확인합니다.

위에 표시된 예시를 수정하려면 다음과 같이 <TimeUnit> 요소를 포함하도록 정책을 수정할 수 있습니다.

<Quota async="false" continueOnError="false" enabled="true" name="CheckQuota" type="calendar">
    <DisplayName>CheckQuota</DisplayName>
    <Properties/>
    <Allow count="3"/>
    <TimeUnit ref="verifyapikey.verify-api-key.apiproduct.developer.quota.timeunit">hour</TimeUnit>
    <Interval ref="verifyapikey.verify-api-key.apiproduct.developer.quota.interval">1</Interval>
    <StartTime>2017-7-16 12:00:00</StartTime>
</Quota>