{"record":{"id":"2c3eacb683f6a2d3","repo":"juspay/hyperswitch","slug":"missing-connectorid-or-methodflow-in-globalstate","errorCode":null,"errorMessage":"Missing connectorId or methodFlow in globalState","messagePattern":"Missing connectorId or methodFlow in globalState","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cypress-tests/cypress/support/commands.js","lineNumber":254,"sourceCode":"      \"cli_log\",\n      `UCS ${type} config creation skipped - ucsEnabled is false or not set`\n    );\n    return;\n  }\n\n  const httpUrl = globalState.get(\"proxyHttp\");\n  const httpsUrl = globalState.get(\"proxyHttps\");\n  const connector = globalState.get(\"connectorId\");\n  const methodFlowInput = flow || globalState.get(\"methodFlow\");\n\n  if (!httpUrl || !httpsUrl) {\n    throw new Error(\n      `Missing proxyHttp or proxyHttps in globalState. globalState.proxyHttp=${httpUrl}, globalState.proxyHttps=${httpsUrl}, Cypress.env(\"PROXY_HTTP\")=${Cypress.env(\"PROXY_HTTP\")}, Cypress.env(\"PROXY_HTTPS\")=${Cypress.env(\"PROXY_HTTPS\")}`\n    );\n  }\n\n  if (!connector || !methodFlowInput) {\n    throw new Error(\"Missing connectorId or methodFlow in globalState\");\n  }\n\n  if (!globalState) {\n    throw new Error(\"Missing required parameter: globalState\");\n  }\n\n  // --- Phase 2: Data Preparation ---\n  const merchantId = globalState.get(\"merchantId\");\n  const adminApiKey = globalState.get(\"adminApiKey\");\n  const baseUrl = globalState.get(\"baseUrl\");\n\n  if (!merchantId || !adminApiKey || !baseUrl) {\n    throw new Error(\n      \"Missing merchantId, adminApiKey, or baseUrl in globalState\"\n    );\n  }\n\n  const methodFlows = parseMethodFlows(methodFlowInput);","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/juspay/hyperswitch/blob/9b8b89dc378b62c9a6feda647bad4719d2de7699/cypress-tests/cypress/support/commands.js#L236-L272","documentation":"Thrown by createUcsConfigs in cypress-support/commands.js when globalState lacks connectorId or methodFlow (either the flow argument or globalState.get('methodFlow')). These identify which connector and which payment method flows the UCS rollout/shadow config applies to. (Note the adjacent `if (!globalState)` check at line 256 is dead code — globalState was already dereferenced twice above — so the real guards are the ordered value checks.)","triggerScenarios":"A UCS-enabled spec runs without the connector tag/param (globalState.connectorId unset) or without METHOD_FLOW configured, and createUcsConfigs was not passed an explicit flow argument.","commonSituations":"UCS specs invoked without the usual test tags (connector, method flow) — e.g. ad-hoc --spec runs that skip tag parsing; new specs forgetting the methodFlow tag; sharded runs where tags are injected only in some jobs.","solutions":["Run the spec with the required tags/env so globalState gets connectorId and methodFlow (e.g. the connector and METHOD_FLOW env)","Pass the flow explicitly where it is known: createUcsConfigs(globalState, 'upi_intent', 'rollout')","If UCS is not intended for this suite, set ucsEnabled false so creation is skipped with a log instead of throwing","Move the dead !globalState check above the first globalState.get() call while you are in the file"],"exampleFix":"// before\ncreateUcsUppConfig(globalState, 'rollout'); // no flow arg, no METHOD_FLOW env\n// throws: Missing connectorId or methodFlow in globalState\n\n// after\nCypress.env('METHOD_FLOW', 'upi_intent');\ncreateUcsUppConfig(globalState, 'rollout');\n// or pass explicitly: createUcsConfigs(globalState, 'upi_intent', 'rollout')","handlingStrategy":"validation","validationCode":"const connector = globalState.get('connectorId');\nconst methodFlowInput = flow || globalState.get('methodFlow');\nif (!ucsEnabled) return; // explicit opt-in only\nif (!connector || !methodFlowInput) {\n  cy.log(`UCS config creation skipped: connector=${connector}, methodFlow=${methodFlowInput}`);\n  return;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run UCS specs through the tagged runner so connectorId/methodFlow reach globalState","Pass the flow explicitly when a spec knows it, reducing dependence on tags","Fix the dead `if (!globalState)` check placement while editing this function"],"tags":["cypress","ucs","configuration","validation"],"backgroundTag":null,"analyzedSha":"9b8b89dc378b62c9a6feda647bad4719d2de7699","analyzedAt":"2026-08-16T09:01:53.433Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}