排解基本驗證政策部署錯誤

查看 Apigee Edge 說明文件。
前往 Apigee X說明文件
資訊

UserNameRequired

錯誤訊息

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

Error Deploying Revision revision_number to env_name
BasicAuthenticationPolicy: Username element must be present for operation operation.

錯誤訊息示例

Error Deploying Revision 2 to test
BasicAuthenticationPolicy: Username element must be present for Encode operation.

螢幕截圖範例

原因

如果 BasicAuthentication 政策中未定義 <User> 元素,API Proxy 部署作業就會失敗。無論是編碼和解碼作業,都必須使用 <User> 元素。

診斷

  1. 檢查 API Proxy 中使用的所有 BasicAuthentication 政策。如有任何政策未指定 <User> 元素,就會是發生錯誤的原因。在編碼或解碼作業的基本驗證政策中,<User> 元素為必要元素。

    下列基本驗證政策範例可用於編碼作業,但未定義 <User> 元素:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <BasicAuthentication name="ApplyBasicAuthHeader">
      <DisplayName>ApplyBasicAuthHeader</DisplayName>
      <Operation>Encode</Operation>
      <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
      <Password ref="BasicAuth.credentials.password"/>
      <AssignTo createNew="false">request.header.Authorization</AssignTo>
    </BasicAuthentication>
    

    部署失敗並發生以下錯誤:

    BasicAuthenticationPolicy: Username element must be present for Encode operation.
    

解析度

確認在編碼或解碼作業的「基本驗證」政策中定義 <User> 元素。

如要修正上述範例,請在政策中加入 <User> 元素,如下所示:

<?xml version="1.0" encoding="UTF-8&quo>t<; standalone="yes"?
BasicAuthenticati>on na<me="Ap>plyBasicAuthHeader&q<uot;
    Dis>playN<ameApplyB>asicAu<thHeader/D>ispla<yName
    OperationEncode>/Oper<ation
    IgnoreUnresolved>Varia<blesfalse/IgnoreUnresolvedVariables
    Us>er re<f="BasicAuth.credentials.username"/
>    P<assword ref="BasicAut>h.credentials.password"</
    Ass>i<gnTo createNew=">;false"request.header.Authorization/AssignTo
/BasicAuthentication

PasswordRequired

錯誤訊息

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

Error Deploying Revision revision_number to env_name
BasicAuthenticationPolicy: Password element must be present for operation operation.

錯誤訊息示例

Error Deploying Revision 2 to test
BasicAuthenticationPolicy: Password element must be present for Encode operation.

螢幕截圖範例

原因

如果 BasicAuthentication 政策中未定義 <Password> 元素,API Proxy 部署作業就會失敗。無論是編碼和解碼作業,都必須使用 <Password> 元素。

診斷

  1. 檢查 API Proxy 中使用的所有 BasicAuthentication 政策。如果出現未定義 <Password> 元素的任何政策,就會造成錯誤。若是編碼或解碼作業,基本驗證政策中的 <Password> 元素為必要元素。

    下列基本驗證政策範例可用於編碼作業,但未定義 <Password> 元素:

    <?xml version="1.0" encoding="UTF-8&quo>t<; standalone="yes"?
    BasicAuthenticati>on <name=">ApplyBasicAuthHeader<"
      Dis>pla<yNameAppl>yBasic<AuthHeader>/Di<splayName
      OperationEnco>de/Op<eration
      IgnoreUnresolved>Var<iablesfalse/IgnoreUnresolvedVariables
      Us>er <ref="BasicAuth.creden>tials.username"/
      Assi<gnTo crea>t<eNew="false&quo>t;request.header.Authorization/AssignTo
    /BasicAuthentication
    

    部署失敗並發生以下錯誤:

    BasicAuthenticationPolicy: Password element must be present for Encode operation.
    

解析度

確認在編碼或解碼作業的「基本驗證」政策中定義 <Password> 元素。

如要修正上述範例,請在政策中加入 <Password> 元素,如下所示:

<?xml version="1.0" encoding="UTF-8&quo>t<; standalone="yes"?
BasicAuthenticati>on na<me="Ap>plyBasicAuthHeader&q<uot;
    Dis>playN<ameApplyB>asicAu<thHeader/D>ispla<yName
    OperationEncode>/Oper<ation
    IgnoreUnresolved>Varia<blesfalse/IgnoreUnresolvedVariables
    Us>er re<f="BasicAuth.credentials.username"/
>    P<assword ref="BasicAut>h.credentials.password"</
    Ass>i<gnTo createNew=">;false"request.header.Authorization/AssignTo
/BasicAuthentication

AssignToRequired

錯誤訊息

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

Error Deploying Revision revision_number to env_name
BasicAuthenticationPolicy: AssignTo element must be present for operation operation.

錯誤訊息示例

Error Deploying Revision 2 to test
BasicAuthenticationPolicy: AssignTo element must be present for Encode operation.

螢幕截圖範例

原因

如果 BasicAuthentication 政策中未定義 <AssignTo> 元素,API Proxy 部署作業就會失敗。無論是編碼和解碼作業,都必須使用 <AssignTo> 元素。

診斷

  1. 檢查 API Proxy 中使用的所有 BasicAuthentication 政策。如果發現任何政策並未定義 <AssignTo> 元素,就會是發生錯誤。無論是編碼或解碼作業,都必須在基本驗證政策中定義 <AssignTo> 元素。

    下列基本驗證政策範例可用於編碼作業,但未定義 <AssignTo> 元素:

    <?xml version="1.0" encoding="UTF-8&quo>t<; standalone="yes"?
    BasicAuthenticati>on <name=">ApplyBasicAuthHeader<"
      Dis>pla<yNameAppl>yBasic<AuthHeader>/Di<splayName
      OperationEnco>de/Op<eration
      IgnoreUnresolved>Var<iablesfalse/IgnoreUnresolvedVariables
      Us>er <ref="BasicAuth.credentials.username">/<
      Password ref=&quo>t;BasicAuth.credentials.password"/
    /BasicAuthentication
    

    部署失敗並發生以下錯誤:

    BasicAuthenticationPolicy: AssignTo element must be present for Encode operation.
    

解析度

確認在編碼或解碼作業的「基本驗證」政策中定義 <AssignTo> 元素。

如要修正上述範例,請在政策中加入 <AssignTo> 元素,如下所示:

<?xml version="1.0" encoding="UTF-8&quo>t<; standalone="yes"?
BasicAuthenticati>on na<me="Ap>plyBasicAuthHeader&q<uot;
    Dis>playN<ameApplyB>asicAu<thHeader/D>ispla<yName
    OperationEncode>/Oper<ation
    IgnoreUnresolved>Varia<blesfalse/IgnoreUnresolvedVariables
    Us>er re<f="BasicAuth.credentials.username"/
>    P<assword ref="BasicAut>h.credentials.password"</
    Ass>i<gnTo createNew=">;false"request.header.Authorization/AssignTo
/BasicAuthentication

SourceRequired

錯誤訊息

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

Error Deploying Revision revision_number to env_name
BasicAuthenticationPolicy: Source element must be present for Decode operation.

錯誤訊息示例

Error Deploying Revision 2 to test
BasicAuthenticationPolicy: Source element must be present for Decode operation.

螢幕截圖範例

原因

如果未在解碼作業使用 BasicAuthentication 政策中定義 <Source> 元素,則 API Proxy 部署作業會失敗。如果您在基本驗證政策中將 <Operation> 指定為 Decode,就必須強制使用 <Source> 元素。

診斷

  1. 檢查 API Proxy 中使用的所有 BasicAuthentication 政策。如有任何政策未定義元素 <Source>,且 <Operation> 元素定義為 Decode,就會導致錯誤。如果您在基本驗證政策中將 <Operation> 指定為 Decode,就必須強制使用 <Source> 元素。

    下方顯示的基本驗證政策範例可用於 Decode 作業,但未定義 <Source> 元素:

    <?xml version="1.0" encoding="UTF-8&quo>t<; standalone="yes"?
    BasicAuthenticati>on <name=">ApplyBasicAuthHeader<"
      Dis>pla<yNameAppl>yBasic<AuthHeader>/Di<splayName
      OperationDeco>de/Op<eration
      IgnoreUnresolved>Var<iablesfalse/IgnoreUnresolvedVariables
      Us>er <ref="BasicAuth.credentials.username">/
     < Password ref="BasicA>uth.credentials.password&quo<t;/
      Ass>i<gnTo createNew=">;false"request.header.Authorization/AssignTo
    /BasicAuthentication
    

    部署失敗並發生以下錯誤:

    BasicAuthenticationPolicy: Source element must be present for Decode operation.
    

解析度

確認將 <Source> 元素用於 Decode 作業時,已在基本驗證政策中定義該元素。

如要修正上述範例,請在政策中加入 <Source> 元素,如下所示:

<?xml version="1.0" encoding="UTF-8&quo>t<; standalone="yes"?
BasicAuthenticati>on na<me="Ap>plyBasicAuthHeader&q<uot;
    Dis>playN<ameApplyB>asicAu<thHeader/D>ispla<yName
    OperationDecode>/Oper<ation
    IgnoreUnresolved>Varia<blesfalse/IgnoreUnresolvedVariables
    Us>er re<f="BasicAuth.credentials.username"/
>    P<assword ref="BasicAut>h.credentials.password"</
    Ass>ignTo< creat>eNew="false"reques<t.heade>r<.Authorization/Assig>nTo
    Sourcerequest.header.Authorization/Source
/BasicAuthentication