Pemecahan masalah error deployment kebijakan Cache Lookup

Anda sedang melihat dokumentasi Apigee Edge.
Buka dokumentasi Apigee X.
info

InvalidTimeout

Pesan Error

Deployment proxy API melalui UI Edge atau Edge management API gagal dengan pesan error ini:

Error Saving Revision revision_number
CacheLookupTimeoutInSeconds value value should be greater than zero.

Contoh Pesan Error

Error Saving Revision 2
CacheLookupTimeoutInSeconds -1 value should be greater than zero.

Contoh Screenshot Error

Penyebab

Jika elemen <CacheLookupTimeoutInSeconds> dari kebijakan LookupCache ditetapkan ke angka negatif, deployment proxy API akan gagal.

Misalnya, jika elemen <CacheLookupTimeoutInSeconds> adalah -1, deployment proxy API akan gagal.

Diagnosis

  1. Identifikasi nilai yang tidak valid yang ditentukan untuk elemen <CacheLookupTimeoutInSeconds> dalam kebijakan LookupCache. Anda dapat menemukan informasi ini di pesan error. Misalnya, dalam error berikut, nilai yang tidak valid digunakan untuk elemen <CacheLookupTimeoutInSeconds> adalah -1:

    CacheLookupTimeoutInSeconds -1 value should be greater than zero.
    
  2. Periksa semua kebijakan LookupCache di Proxy API tertentu tempat kegagalan terjadi. Mungkin ada satu atau beberapa kebijakan LookupCache yang menentukan elemen <CacheLookupTimeoutInSeconds>. Identifikasi kebijakan LookUpCache dengan nilai yang tidak valid (diidentifikasi pada langkah #1 di atas) ditentukan untuk elemen <CacheLookupTimeoutInSeconds>.

    Misalnya, konfigurasi kebijakan berikut menentukan nilai <CacheLookupTimeoutInSeconds> dari -1, yang cocok dengan pesan error:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <LookupCache async="false" continueOnError="false" enabled="true" name="LookupCache-Token">
        <DisplayName>LookupCache-Token</DisplayName>
        <Properties/>
        <CacheKey>
            <Prefix/>
            <KeyFragment ref="request.queryparam.client_id"/>
        </CacheKey>
        <CacheLookupTimeoutInSeconds>-1</CacheLookupTimeoutInSeconds>
        <Scope>Exclusive</Scope>
        <ExpirySettings>
            <TimeoutInSec>3600</TimeoutInSec>
        </ExpirySettings>
        <AssignTo>usertoken</AssignTo>
    </LookupCache>
    
  3. Jika <CacheLookupTimeoutInSeconds> ditentukan sebagai bilangan bulat negatif, berarti itulah penyebab error.

Resolusi

Pastikan nilai untuk elemen <CacheLookupTimeoutInSeconds> dari kebijakan LookupCache selalu ditentukan sebagai bilangan bulat non-negatif.

Untuk memperbaiki contoh kebijakan LookupCache yang ditampilkan di atas, Anda dapat mengubah elemen <CacheLookupTimeoutInSeconds> menjadi 30.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<LookupCache async="false" continueOnError="false" enabled="true" name="LookupCache-Token">
    <DisplayName>LookupCache-Token</DisplayName>
    <Properties/>
    <CacheKey>
        <Prefix/>
        <KeyFragment ref="request.queryparam.client_id"/>
    </CacheKey>
    <CacheResource>tokencache</CacheResource>
    <CacheLookupTimeoutInSeconds>30</CacheLookupTimeoutInSeconds>
    <Scope>Exclusive</Scope>
    <ExpirySettings>
        <TimeoutInSec>3600</TimeoutInSec>
    </ExpirySettings>
    <AssignTo>usertoken</AssignTo>
</LookupCache>

InvalidCacheResourceReference

Pesan Error

Deployment proxy API melalui UI Edge atau Edge management API gagal dengan pesan error ini:

Error Deploying Revision revision_number to environment
Invalid cache resource reference [cache_resource] in Step definition [populate_cache_policy_name]. Context Revision:[revision_number];APIProxy:ResponseCache;Organization:[organization];Environment:[environment]

Contoh Pesan Error

Error Deploying Revision 2 to test
Invalid cache resource reference tokencache in Step definition LookupCache-Token. Context Revision:2;APIProxy:TestCache;Organization:kkalckstein-eval;Environment:test

Contoh Screenshot Error

Penyebab

Error ini terjadi jika elemen <CacheResource> disetel ke nama yang tidak ada di lingkungan tempat proxy API di-deploy.

Diagnosis

  1. Identifikasi cache tidak valid yang digunakan di elemen <CacheResource> dari kebijakan LookupCache dan lingkungan tempat error terjadi. Anda dapat menemukan kedua item ini dalam pesan error. Misalnya, dalam error berikut, nama cache yang tidak valid adalah tokencache dan nama lingkungannya adalah test.

    Invalid cache resource reference tokencache in Step definition LookupCache-Token. Context Revision:2;APIProxy:TestCache;Organization:kkalckstein-eval;Environment:test
    
  2. Periksa semua kebijakan LookupCache di Proxy API tertentu tempat kegagalan terjadi. Identifikasi kebijakan LookupCache tertentu tempat cache yang tidak valid (diidentifikasi pada langkah #1) ditentukan dalam elemen <CacheResource> yang ditentukan.

    Misalnya, kebijakan berikut menentukan nilai <CacheResource> sebagai tokencache, yang cocok dengan pesan error:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <LookupCache async="false" continueOnError="false" enabled="true" name="LookupCache-Token">
        <DisplayName>LookupCache-Token</DisplayName>
        <Properties/>
        <CacheKey>
            <Prefix/>
            <KeyFragment ref="request.queryparam.client_id"/>
        </CacheKey>
        <CacheResource>tokencache</CacheResource>
        <CacheLookupTimeoutInSeconds/>
        <Scope>Exclusive</Scope>
        <ExpirySettings>
            <TimeoutInSec>3600</TimeoutInSec>
        </ExpirySettings>
        <AssignTo>usertoken</AssignTo>
    </LookupCache>
    
  3. Verifikasi apakah cache (ditentukan di langkah #1) telah ditetapkan di lingkungan tertentu (diidentifikasi pada langkah #1).

    Di UI Edge, buka ADMIN > Environment > test dan periksa apakah cache tersebut ada di tab Caches di Environment Configuration. Jika cache tidak ada, berarti itulah penyebab error.

    Misalnya, perhatikan pada screenshot di bawah bahwa cache yang bernama tokencache tidak ada.

    Karena cache bernama tokencache tidak ditentukan dalam lingkungan test, Anda mendapatkan error:

    Invalid cache resource reference tokencache in Step definition LookupCache-Token. Context Revision:2;APIProxy:TestCache;Organization:kkalckstein-eval;Environment:test
    
    

Resolusi

Pastikan nama cache yang ditentukan dalam elemen <CacheResource> telah dibuat di lingkungan tempat Anda ingin men-deploy proxy API.

Baca artikel Membuat dan mengedit cache lingkungan untuk informasi tentang cara membuat cache.

CacheNotFound

Pesan Error

Deployment proxy API melalui Edge UI atau Edge management API akan menghasilkan pesan error seperti ini, dan status deployment Proxy API ditandai sebagai di-deploy sebagian:

Error: Cache : cache_resource, not found in organization : organization__environment.

Contoh Pesan Error

Error Cache : configCache, not found in organization : kkalckstein-eval__test

Penyebab

Error ini terjadi jika cache tertentu yang disebutkan dalam pesan error tidak dibuat di komponen Pemroses Pesan tertentu.

Resolusi

Jika Anda adalah pengguna Private Cloud, ikuti petunjuk di bawah ini:

  1. Cantumkan deployment proxy API, lalu tentukan Pemroses Pesan mana yang mengalami error steps.cache.CacheNotFound.

    curl -u $USERID:$USERPASSWORD http://:8080/v1/organizations//environments//apis//revisions//deployments

    Contoh Output

    {
      "aPIProxy" : "TestCache",
      "environment" : [ {
        "configuration" : {
          "basePath" : "/",
          "configVersion" : "SHA-512:45d3f39783414d3859bf2dec4135d8f5f9960ee6b2d361db2799c82693a8e3f8b95dbbb37c547eb3c0a3819d8ca51727f390502bcaefdf1f113263521a9023b6",
          "steps" : [ ]
        },
        "name" : "prod",
        "server" : [ {
          "pod" : {
            "name" : "pod1",
            "region" : "us-central1"
          },
          "status" : "deployed",
          "type" : [ "message-processor" ],
          "uUID" : "f2e5e34a-5630-43a9-8fef-48a5b9da76d1"
        }, {
          "pod" : {
            "name" : "pod1",
            "region" : "us-central1"
          },
          "status" : "deployed",
          "type" : [ "message-processor" ],
          "uUID" : "879a6538-a5e0-4503-b142-9cb2b4e0623d"
        }, {
        "error" : "Cache : configCache, not found in organization : kkalckstein-eval__test",
        "errorCode" : "steps.cache.CacheNotFound",
        "status" : "error",
        "type" : [ "message-processor" ],
         "uUID" : "a8f9ce0b-c32d-48a9-b26c-9c75d8bf467d"
    },
    ...
        "state" : "deployed"
      } ],
      "name" : "2",
      "organization" : "kkalckstein-eval"
      ...
    
  2. Perhatikan UUID Pemroses Pesan tempat Anda mengamati error steps.cache.CacheNotFound. Identifikasi nama host/alamat IP Pemroses Pesan yang terkait dengan UUID.

  3. Login ke Pemroses Pesan tertentu, lalu mulai ulang menggunakan perintah berikut:

    apigee-service edge-message-processor restart

Jika Anda adalah pengguna Public Cloud atau jika masalah terus berlanjut untuk Private Cloud, hubungi Dukungan Apigee untuk mendapatkan bantuan.