您目前查看的是 Apigee 和 Apigee Hybrid 說明文件。
查看
Apigee Edge 說明文件。
UserNameRequired
錯誤訊息
透過 Apigee 使用者介面或 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 部署作業就會失敗。Encode 和 Decode 作業都必須使用 <User> 元素。
診斷
檢查 API Proxy 中使用的所有 BasicAuthentication 政策。如果任何政策未指定
<User>元素,就會導致錯誤。在 BasicAuthentication 政策中,Encode 或 Decode 作業必須使用<User>元素。以下範例 BasicAuthentication 政策用於 Encode 作業,但未定義
<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.
解析度
請確保在 BasicAuthentication 政策中,為 Encode 或 Decode 作業定義 <User> 元素。
如要修正上述範例,請在政策中加入 <User> 元素,如下所示:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BasicAuthentication name="ApplyBasicAuthHeader">
<DisplayName>ApplyBasicAuthHeader</DisplayName>
<Operation>Encode</Operation>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<User ref="BasicAuth.credentials.username"/>
<Password ref="BasicAuth.credentials.password"/>
<AssignTo createNew="false">request.header.Authorization</AssignTo>
</BasicAuthentication>
PasswordRequired
錯誤訊息
透過 Apigee 使用者介面或 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 部署作業就會失敗。Encode 和 Decode 作業都必須使用 <Password> 元素。
診斷
檢查 API Proxy 中使用的所有 BasicAuthentication 政策。如果任何政策未定義
<Password>元素,就是造成錯誤的原因。在 BasicAuthentication 政策中,Encode 或 Decode 作業必須使用<Password>元素。以下範例 BasicAuthentication 政策用於 Encode 作業,但未定義
<Password>元素:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <BasicAuthentication name="ApplyBasicAuthHeader"> <DisplayName>ApplyBasicAuthHeader</DisplayName> <Operation>Encode</Operation> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <User ref="BasicAuth.credentials.username"/> <AssignTo createNew="false">request.header.Authorization</AssignTo> </BasicAuthentication>部署作業失敗,並顯示下列錯誤:
BasicAuthenticationPolicy: Password element must be present for Encode operation.
解析度
請確保在 BasicAuthentication 政策中,為 Encode 或 Decode 作業定義 <Password> 元素。
如要修正上述範例,請在政策中加入 <Password> 元素,如下所示:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BasicAuthentication name="ApplyBasicAuthHeader">
<DisplayName>ApplyBasicAuthHeader</DisplayName>
<Operation>Encode</Operation>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<User ref="BasicAuth.credentials.username"/>
<Password ref="BasicAuth.credentials.password"/>
<AssignTo createNew="false">request.header.Authorization</AssignTo>
</BasicAuthentication>
AssignToRequired
錯誤訊息
透過 Apigee 使用者介面或 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 部署作業就會失敗。Encode 和 Decode 作業都必須使用 <AssignTo> 元素。
診斷
檢查 API Proxy 中使用的所有 BasicAuthentication 政策。如果任何政策未定義
<AssignTo>元素,就是造成錯誤的原因。在 BasicAuthentication 政策中,Encode 和 Decode 作業都必須定義<AssignTo>元素。以下範例 BasicAuthentication 政策用於 Encode 作業,但未定義
<AssignTo>元素:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <BasicAuthentication name="ApplyBasicAuthHeader"> <DisplayName>ApplyBasicAuthHeader</DisplayName> <Operation>Encode</Operation> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <User ref="BasicAuth.credentials.username"/> <Password ref="BasicAuth.credentials.password"/> </BasicAuthentication>部署作業失敗,並顯示下列錯誤:
BasicAuthenticationPolicy: AssignTo element must be present for Encode operation.
解析度
請確保在 BasicAuthentication 政策中,為 Encode 或 Decode 作業定義 <AssignTo> 元素。
如要修正上述範例,請在政策中加入 <AssignTo> 元素,如下所示:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BasicAuthentication name="ApplyBasicAuthHeader">
<DisplayName>ApplyBasicAuthHeader</DisplayName>
<Operation>Encode</Operation>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<User ref="BasicAuth.credentials.username"/>
<Password ref="BasicAuth.credentials.password"/>
<AssignTo createNew="false">request.header.Authorization</AssignTo>
</BasicAuthentication>
SourceRequired
錯誤訊息
透過 Apigee 使用者介面或 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 部署作業就會失敗。如果 BasicAuthentication 政策中的 <Operation> 指定為 Decode,則必須使用 <Source> 元素。
診斷
檢查 API Proxy 中使用的所有 BasicAuthentication 政策。如果任何政策未定義
<Source>元素,且<Operation>元素定義為Decode,就會導致錯誤。如果 BasicAuthentication 政策中的<Operation>指定為Decode,則必須使用<Source>元素。以下顯示的 BasicAuthentication 政策範例用於
Decode作業,但未定義<Source>元素:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <BasicAuthentication name="ApplyBasicAuthHeader"> <DisplayName>ApplyBasicAuthHeader</DisplayName> <Operation>Decode</Operation> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <User ref="BasicAuth.credentials.username"/> <Password ref="BasicAuth.credentials.password"/> <AssignTo createNew="false">request.header.Authorization</AssignTo> </BasicAuthentication>部署作業失敗,並顯示下列錯誤:
BasicAuthenticationPolicy: Source element must be present for Decode operation.
解析度
如果 <Source> 元素用於 Decode 作業,請務必在 BasicAuthentication 政策中定義該元素。
如要修正上述範例,請在政策中加入 <Source> 元素,如下所示:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<BasicAuthentication name="ApplyBasicAuthHeader">
<DisplayName>ApplyBasicAuthHeader</DisplayName>
<Operation>Decode</Operation>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<User ref="BasicAuth.credentials.username"/>
<Password ref="BasicAuth.credentials.password"/>
<AssignTo createNew="false">request.header.Authorization</AssignTo>
<Source>request.header.Authorization</Source>
</BasicAuthentication>