Error ini terjadi jika nilai yang ditentukan untuk elemen <MessageWeight> melalui variabel alur tidak valid (nilai non-bilangan bulat).
Misalnya, jika nilai variabel flow yang ditentukan untuk elemen <MessageWeight>
adalah 1,5 (nilai non-bilangan bulat), error akan terjadi.
Diagnosis
Identifikasi nilai yang tidak valid yang digunakan untuk elemen <MessageWeight> dalam kebijakan Penangkapan
Puncak. Anda dapat menemukan informasi ini di elemen faultstring dari
respons error. Misalnya, dalam error berikut, nilai yang tidak valid yang digunakan untuk
elemen <MessageWeight> adalah 1.5:
"faultstring": "Invalid message weight value 1.5"
Periksa semua kebijakan Spike Arrest di Proxy API tertentu tempat
kegagalan terjadi. Mungkin ada satu atau beberapa kebijakan Spike Arrest yang menentukan elemen <MessageWeight>.
Misalnya, kebijakan berikut menentukan nilai <MessageWeight>
melalui variabel alur yang disebut message_weight:
Tentukan nilai variabel yang digunakan dalam elemen <MessageWeight> dari
Kebijakan Penghentian Lonjakan yang diidentifikasi. Nilai variabel alur dapat
diekstrak dari header HTTP, parameter kueri, payload permintaan XML atau JSON,
atau ditentukan dalam kebijakan lain.
Temukan kode dalam proxy API, tempat variabel ditentukan terlebih dahulu.
Setelah Anda mengetahui kebijakan tempat variabel ditentukan dan
diisi terlebih dahulu, periksa cara penetapan nilai untuk variabel tersebut.
Jika nilai variabel flow cocok dengan nilai yang diidentifikasi pada Langkah
#1 di atas, berarti itulah penyebab error.
Misalnya, asumsikan bahwa kebijakan JavaScript digunakan sebelum Kebijakan Penangkapan Lonjakan
untuk menetapkan variabel message_weight berdasarkan metode permintaan seperti
yang ditunjukkan di bawah:
Error ini terjadi jika referensi ke variabel yang berisi setelan tarif dalam elemen <Rate> tidak dapat di-resolve ke nilai dalam kebijakan Spike Arrest. Elemen ini bersifat wajib dan digunakan untuk menentukan tingkat penangkapan lonjakan dalam
bentuk {int}pm atau {int}ps. Misalnya, {int}pm mungkin 500pm,
yang berarti 500 panggilan per menit. Demikian pula, nilai 10ps berarti 10 panggilan per
detik.
Diagnosis
Identifikasi kebijakan Spike Arrest tempat error terjadi dan nama
referensi yang tidak dapat di-resolve dengan benar. Anda dapat menemukan kedua item ini
dalam elemen faultstring respons error.
Misalnya, dalam faultstring berikut, nama kebijakan adalah
SpikeArrest_AuthProxy dan referensinya adalah request.header.rate:
"faultstring": "Failed to resolve Spike Arrest Rate reference request.header.rate in SpikeArrest policy SpikeArrest_AuthProxy"
Dalam XML kebijakan Spike Arrest yang gagal, pastikan nama referensi yang digunakan cocok dengan nama referensi yang diidentifikasi dalam string error (langkah #1 di atas). ** **
Misalnya, kebijakan berikut menetapkan elemen dengan referensi
bernama request.header.rate, yang cocok dengan yang ada dalam faultstring:
Tentukan apakah variabel ditentukan dan tersedia dalam alur tempat
kebijakan Spike Arrest dijalankan.
Jika variabel adalah:
di luar cakupan (tidak tersedia dalam alur tertentu tempat kebijakan dijalankan) atau
tidak dapat diselesaikan (tidak ditentukan)
maka itu adalah penyebab error.
Pada contoh yang ditampilkan di atas, nilai rasio penangkapan lonjakan di elemen <Rate>
seharusnya diambil dari header permintaan bernama rate.
Namun, Apigee tidak dapat me-resolve request.header.rate. Hal ini terjadi
jika header rate tidak diteruskan sebagai bagian dari permintaan API.
Berikut adalah contoh permintaan API yang tidak meneruskan header rate sebagai bagian dari
permintaan:
Dengan your_host_alias adalah domain yang ditampilkan secara publik yang digunakan untuk mengakses API Anda,
seperti yang dikonfigurasi dalam properti virtualhosts.hostAliases di file penggantian Anda.
Lihat Menentukan penggantian konfigurasi.
Karena header rate tidak diteruskan sebagai bagian dari permintaan, referensi
request.header.rate yang digunakan dalam elemen <Rate> dalam kebijakan Spike
Arrest di atas tidak ditentukan sehingga tidak dapat di-resolve. Jadi, Anda akan menerima
kode error:
policies.ratelimit.FailedToResolveSpikeArrestRate
Resolusi
Pastikan variabel yang dirujuk dalam elemen <Rate> ada/ditentukan
dan tersedia dalam alur tertentu, tempat kebijakan Spike Arrest dijalankan.
Untuk memperbaiki contoh yang ditampilkan di atas, Anda dapat mengubah permintaan untuk menyertakan header rate seperti yang ditunjukkan di bawah:
Dengan your_host_alias adalah domain yang ditampilkan secara publik yang digunakan untuk mengakses API Anda,
seperti yang dikonfigurasi dalam properti virtualhosts.hostAliases di file penggantian Anda.
Lihat Menentukan penggantian konfigurasi.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[[["\u003cp\u003eThis documentation covers troubleshooting for two specific error codes within Apigee and Apigee hybrid environments: \u003ccode\u003epolicies.ratelimit.InvalidMessageWeight\u003c/code\u003e and \u003ccode\u003epolicies.ratelimit.FailedToResolveSpikeArrestRate\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003epolicies.ratelimit.InvalidMessageWeight\u003c/code\u003e error occurs when a non-integer value is used for the \u003ccode\u003e<MessageWeight>\u003c/code\u003e element within a Spike Arrest policy, which can be diagnosed by examining the \u003ccode\u003efaultstring\u003c/code\u003e and the definition of the message weight variable.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003epolicies.ratelimit.FailedToResolveSpikeArrestRate\u003c/code\u003e error happens when the \u003ccode\u003e<Rate>\u003c/code\u003e element in a Spike Arrest policy refers to a variable that is undefined or not available in the current flow, and its diagnosis involves identifying the unresolved reference and verifying its availability in the flow.\u003c/p\u003e\n"],["\u003cp\u003eResolving the \u003ccode\u003eInvalidMessageWeight\u003c/code\u003e error involves ensuring that the \u003ccode\u003e<MessageWeight>\u003c/code\u003e value is an integer, while fixing the \u003ccode\u003eFailedToResolveSpikeArrestRate\u003c/code\u003e error requires verifying that the referenced variable within \u003ccode\u003e<Rate>\u003c/code\u003e is defined and accessible in the policy's execution flow.\u003c/p\u003e\n"],["\u003cp\u003eThe rate for the spike arrest policy is to be of the format {int}pm or {int}ps, for instance, 500pm or 10ps.\u003c/p\u003e\n"]]],[],null,["# Spike Arrest policy runtime error troubleshooting\n\n*You're viewing **Apigee** and **Apigee hybrid** documentation.\nView [Apigee Edge](https://docs.apigee.com/api-platform/troubleshoot/policies/runtime/spike-arrest-runtime-errors) documentation.*\n| **Note:** Was this troubleshooting playbook helpful? Please let us know by clicking [Send Feedback]().\n\nInvalidMessageWeight\n--------------------\n\n### Error code\n\n policies.ratelimit.InvalidMessageWeight\n\n### Error response body\n\n```transact-sql\n{\n \"fault\": {jdoe\n \"faultstring\": \"Invalid message weight value [\u003cvar translate=\"no\"\u003einvalid_value\u003c/var\u003e]\",\n \"detail\": {\n \"errorcode\": \"policies.ratelimit.InvalidMessageWeight\"\n }\n }\n}\n```\n\n**Example Error Message** \n\n```text\n{\n \"fault\": {\n \"faultstring\": \"Invalid message weight value 1.5\",\n \"detail\": {\n \"errorcode\": \"policies.ratelimit.InvalidMessageWeight\"\n }\n }\n}\n```\n\n### Cause\n\nThis error occurs if the value specified for the `\u003cMessageWeight\u003e` element through\na flow variable is invalid (a non-integer value).\n\nFor example, if the value of the flow variable specified for the `\u003cMessageWeight\u003e`\nelement is 1.5 (a non-integer value), then the error occurs.\n\n### Diagnosis\n\n1. Identify the invalid value used for the `\u003cMessageWeight\u003e` element in the Spike\n Arrest policy. You can find this information in the `faultstring` element of the\n error response. For example, in the following error, the invalid value used for\n `\u003cMessageWeight\u003e` element is `1.5`:\n\n \"faultstring\": \"Invalid message weight value 1.5\"\n\n2. Examine all the Spike Arrest policies in the specific API Proxy where the\n failure has occurred. There could be one or more Spike Arrest policies in which\n the `\u003cMessageWeight\u003e` element is specified.\n\n For example, the following policy specifies the value of `\u003cMessageWeight\u003e`\n through a flow variable called `message_weight:` \n\n \u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n \u003cSpikeArrest async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"SpikeArrest_AuthProxy\"\u003e\n \u003cDisplayName\u003eSpikeArrest_AuthProxy\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cIdentifier ref=\"request.header.some-header-name\"/\u003e\n \u003cRate\u003e100ps\u003c/Rate\u003e\n \u003cMessageWeight ref=\"message_weight\"/\u003e\n \u003c/SpikeArrest\u003e\n\n3. Determine the value of the variable used in the `\u003cMessageWeight\u003e` element of\n the identified Spike Arrest Policy(ies). The value of the flow variable can be\n extracted from HTTP headers, query parameters, an XML or JSON request payload,\n or defined in another policy.\n\n 1. Locate the code within the API proxy, where the variable was defined first.\n 2. Once you figure out the policy in which the variable is defined and populated first, check how the value for the variable is set.\n 3. If the value of the flow variable matches the value identified in Step #1 above, then that's the cause of the error.\n\n For example, assume that a JavaScript policy is used before the Spike Arrest\n Policy to set the variable `message_weight` based on the request method as\n shown below: \n\n var verb = context.getVariable(\"request.verb\");\n context.setVariable(\"message_weight\", \"1.5\");\n if (verb == 'POST') {\n context.setVariable(\"message_weight\", \"2\");\n }\n\n Notice that the value of the variable `message_weight` is `1.5` which is\n invalid (a non-integer) value.\n\n### Resolution\n\nEnsure that the value of the `MessageWeight` element is a valid value (integer\nvalue).\n\nTo correct the example shown above, you can modify the value of the variable\n`message_weight` in the JavaScript to be an integer: \n\n var verb = context.getVariable(\"request.verb\");\n context.setVariable(\"message_weight\", \"1\");\n if (verb == 'POST') {\n context.setVariable(\"message_weight\", \"2\");\n }\n\nFailedToResolveSpikeArrestRate\n------------------------------\n\n### Error code\n\n policies.ratelimit.FailedToResolveSpikeArrestRate\n\n### Error response body\n\n```transact-sql\n{\n \"fault\": {\n \"faultstring\": \"Failed to resolve Spike Arrest Rate reference [\u003cvar translate=\"no\"\u003ereference\u003c/var\u003e] in SpikeArrest policy [\u003cvar translate=\"no\"\u003eapi_policy\u003c/var\u003e]\",\n \"detail\": {\n \"errorcode\": \"policies.ratelimit.FailedToResolveSpikeArrestRate\"\n }\n }\n}\n```\n\n**Example Error Message** \n\n```scdoc\n{\n \"fault\": {\n \"faultstring\": \"Failed to resolve Spike Arrest Rate reference request.header.rate in SpikeArrest policy SpikeArrest_AuthProxy\",\n \"detail\": {\n \"errorcode\": \"policies.ratelimit.FailedToResolveSpikeArrestRate\"\n }\n }\n}\n```\n\n### Cause\n\nThis error occurs if the reference to the variable containing the rate setting\nwithin the `\u003cRate\u003e` element cannot be resolved to a value within the Spike Arrest\npolicy. This element is mandatory and used to specify the spike arrest rate in\nthe form of `{int}pm` or `{int}ps`. For example, `{int}pm` might be `500pm`,\nwhich means 500 calls per minute. Likewise, a value of `10ps` means 10 calls per\nsecond.\n\n### Diagnosis\n\n1. Identify the Spike Arrest policy where the error occurred and the name of\n the reference that cannot be resolved properly. You can find both of these items\n in the faultstring element of the error response.\n\n For example, in the following faultstring, the policy name is\n `SpikeArrest_AuthProxy` and the reference is `request.header.rate`: \n\n \"faultstring\": \"Failed to resolve Spike Arrest Rate reference request.header.rate in SpikeArrest policy SpikeArrest_AuthProxy\"\n\n2. In the failed Spike Arrest policy XML, verify that the name of the reference\n used matches the reference name identified in the fault string (step #1 above). \\*\\* \\*\\*\n\n For example, the following policy sets the element with the reference named `request.header.rate`, which matches what's in the faultstring: \n\n \u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n \u003cSpikeArrest async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"SpikeArrest_AuthProxy\"\u003e\n \u003cDisplayName\u003eSpikeArrest_AuthProxy\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cIdentifier ref=\"request.header.some-header-name\"/\u003e\n \u003cRate ref=\"request.header.rate\"/\u003e\n \u003c/SpikeArrest\u003e\n\n3. Determine if the variable is defined and available in the flow in which the\n Spike Arrest policy is being executed.\n\n4. If the variable is either:\n\n - out of scope (not available in the specific flow where the policy is being executed) or\n - can't be resolved (is not defined)\n\n then that's the cause for the error.\n\n In the example shown above, the value of the spike arrest rate in the `\u003cRate\u003e`\n element is supposed to be retrieved from the request header named **rate** .\n However, Apigee is unable to resolve the **request.header.rate** . This happens\n if the header **rate** is not passed as part of the API request.\n\n Here's a sample API request that does not pass the header **rate** as part of\n the request: \n\n ```\n curl -v http://your_host_alias/check_spikearrest -H \"Content-Type: application/json\"\n ```\n\n\n Where \u003cvar translate=\"no\"\u003eyour_host_alias\u003c/var\u003e is a publicly facing domain used to access your APIs,\n as configured in the `virtualhosts.hostAliases` property in your overrides file.\n See [Specify configuration\n overrides](/apigee/docs/hybrid/latest/2-6-install-configure-cluster#specify-configuration-overrides).\n\n \u003cbr /\u003e\n\n Since the header **rate** is not passed as part of the request, reference\n **request.header.rate** used in the element `\u003cRate\u003e` in the above Spike\n Arrest policy is undefined and hence cannot be resolved. So you will receive\n the error code: \n\n policies.ratelimit.FailedToResolveSpikeArrestRate\n\n### Resolution\n\nEnsure that the variable referenced in the `\u003cRate\u003e` element exists/is defined\nand available in the specific flow, where the Spike Arrest policy is being executed.\n\nTo correct the example shown above, you can modify the request to include the **rate** header as shown below: \n\n```\ncurl -v http://your_host_alias/check_spikearrest -H \"Content-Type: application/json\" -H \"rate:30ps\"\n```\n\n\nWhere \u003cvar translate=\"no\"\u003eyour_host_alias\u003c/var\u003e is a publicly facing domain used to access your APIs,\nas configured in the `virtualhosts.hostAliases` property in your overrides file.\nSee [Specify configuration\noverrides](/apigee/docs/hybrid/latest/2-6-install-configure-cluster#specify-configuration-overrides).\n\n\u003cbr /\u003e"]]