{"record":{"id":"658400937cbbc9e2","repo":"juspay/hyperswitch","slug":"key-and-requesttype-are-required-parameters","errorCode":null,"errorMessage":"Key and requestType are required parameters","messagePattern":"Key and requestType are required parameters","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cypress-tests/cypress/support/commands.js","lineNumber":7600,"sourceCode":"  \"extendAuthorizationPostCallTest\",\n  (fixtures, globalState) => {\n    const connector = globalState.get(\"connectorId\");\n    if (connector === \"adyen\") {\n      const data =\n        getConnectorDetails(connector)[\"card_pm\"][\n          \"ExtendAuthorizationNo3DSManual\"\n        ];\n      cy.retrievePaymentCallTest({ globalState, data });\n    } else if (connector === \"paypal\") {\n      const data = getConnectorDetails(connector)[\"card_pm\"][\"Capture\"];\n      cy.captureCallTest(fixtures.captureBody, data, globalState);\n    }\n  }\n);\n\nCypress.Commands.add(\"setConfigs\", (globalState, key, value, requestType) => {\n  if (!key || !requestType) {\n    throw new Error(\"Key and requestType are required parameters\");\n  }\n\n  const REQUEST_CONFIG = {\n    CREATE: { method: \"POST\", useKey: false },\n    UPDATE: { method: \"POST\", useKey: true },\n    FETCH: { method: \"GET\", useKey: true },\n    DELETE: { method: \"DELETE\", useKey: true },\n  };\n\n  const config = REQUEST_CONFIG[requestType];\n  if (!config) {\n    throw new Error(`Invalid requestType: ${requestType}`);\n  }\n\n  const apiKey = globalState.get(\"adminApiKey\");\n  const baseUrl = globalState.get(\"baseUrl\");\n  const url = `${baseUrl}/configs/${config.useKey ? key : \"\"}`;\n","sourceCodeStart":7582,"sourceCodeEnd":7618,"githubUrl":"https://github.com/juspay/hyperswitch/blob/9b8b89dc378b62c9a6feda647bad4719d2de7699/cypress-tests/cypress/support/commands.js#L7582-L7618","documentation":"Thrown synchronously by the setConfigs command when either the key or requestType argument is falsy. setConfigs drives the admin /configs endpoints (CREATE/UPDATE/FETCH/DELETE) and refuses to build a URL/body from missing parameters.","triggerScenarios":"Calling cy.setConfigs(globalState, key, value, requestType) with key undefined (e.g. iterating a list that contains undefined) or requestType omitted; argument order mixed up so an empty value lands in a required slot.","commonSituations":"Looping over config keys where one entry is missing; refactoring call sites and dropping the requestType argument; passing a variable that is conditionally assigned and the condition was false.","solutions":["Inspect the call site and print the exact arguments passed to cy.setConfigs","Default or filter the inputs: only invoke setConfigs when both key and requestType are non-empty","Fix argument order — the signature is (globalState, key, value, requestType)"],"exampleFix":"// before\nrolloutKeys.forEach((key) => cy.setConfigs(globalState, key, '1.0'));\n// after\nrolloutKeys\n  .filter((key) => Boolean(key))\n  .forEach((key) => cy.setConfigs(globalState, key, '1.0', 'CREATE'));","handlingStrategy":"validation","validationCode":"// guard at the call site\nif (!key || !requestType) {\n  throw new Error(\n    `setConfigs requires key and requestType, got key=${key} requestType=${requestType}`\n  );\n}\ncy.setConfigs(globalState, key, value, requestType);","typeGuard":"const isSetConfigsArgs = (globalState, key, value, requestType) =>\n  Boolean(globalState) && typeof key === 'string' && key.length > 0 &&\n  ['CREATE', 'UPDATE', 'FETCH', 'DELETE'].includes(requestType);","tryCatchPattern":null,"preventionTips":["Filter undefined entries out of key lists before iterating into setConfigs","Keep the argument order (globalState, key, value, requestType) enforced by shared wrappers","Print both arguments in your own guard so failures name the missing one"],"tags":["cypress","configs","arguments","validation"],"backgroundTag":null,"analyzedSha":"9b8b89dc378b62c9a6feda647bad4719d2de7699","analyzedAt":"2026-08-16T09:01:53.433Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}