juspay/hyperswitch · error · Error
Key and requestType are required parameters
Error message
Key and requestType are required parameters
What it means
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.
Source
Thrown at cypress-tests/cypress/support/commands.js:7600
"extendAuthorizationPostCallTest",
(fixtures, globalState) => {
const connector = globalState.get("connectorId");
if (connector === "adyen") {
const data =
getConnectorDetails(connector)["card_pm"][
"ExtendAuthorizationNo3DSManual"
];
cy.retrievePaymentCallTest({ globalState, data });
} else if (connector === "paypal") {
const data = getConnectorDetails(connector)["card_pm"]["Capture"];
cy.captureCallTest(fixtures.captureBody, data, globalState);
}
}
);
Cypress.Commands.add("setConfigs", (globalState, key, value, requestType) => {
if (!key || !requestType) {
throw new Error("Key and requestType are required parameters");
}
const REQUEST_CONFIG = {
CREATE: { method: "POST", useKey: false },
UPDATE: { method: "POST", useKey: true },
FETCH: { method: "GET", useKey: true },
DELETE: { method: "DELETE", useKey: true },
};
const config = REQUEST_CONFIG[requestType];
if (!config) {
throw new Error(`Invalid requestType: ${requestType}`);
}
const apiKey = globalState.get("adminApiKey");
const baseUrl = globalState.get("baseUrl");
const url = `${baseUrl}/configs/${config.useKey ? key : ""}`;
View on GitHub (pinned to 9b8b89dc37)
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)
Example fix
// before rolloutKeys.forEach((key) => cy.setConfigs(globalState, key, '1.0')); // after rolloutKeys .filter((key) => Boolean(key)) .forEach((key) => cy.setConfigs(globalState, key, '1.0', 'CREATE'));
Defensive patterns
Strategy: validation
Validate before calling
// guard at the call site
if (!key || !requestType) {
throw new Error(
`setConfigs requires key and requestType, got key=${key} requestType=${requestType}`
);
}
cy.setConfigs(globalState, key, value, requestType); Type guard
const isSetConfigsArgs = (globalState, key, value, requestType) => Boolean(globalState) && typeof key === 'string' && key.length > 0 && ['CREATE', 'UPDATE', 'FETCH', 'DELETE'].includes(requestType);
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid requestType: ${requestType}
- Please provide a baseUrl
- Unsupported baseUrl
- Unsupported keyIdType: ${keyIdType}
- Invalid config: missing path
AI-assisted analysis of juspay/hyperswitch@9b8b89dc37 (2026-08-16).
Data as JSON: /api/errors/658400937cbbc9e2.
Report an issue: GitHub.