{"record":{"id":"a030b892d75c3a8d","repo":"juspay/hyperswitch","slug":"please-provide-a-baseurl","errorCode":null,"errorMessage":"Please provide a baseUrl","messagePattern":"Please provide a baseUrl","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cypress-tests-v2/cypress/utils/RequestBodyUtils.js","lineNumber":30,"sourceCode":"    key_id: \"snd_\",\n  },\n};\n\nexport function isoTimeTomorrow() {\n  const now = new Date();\n\n  // Create a new date object for tomorrow\n  const tomorrow = new Date(now);\n  tomorrow.setDate(now.getDate() + 1);\n\n  // Convert to ISO string format\n  const isoStringTomorrow = tomorrow.toISOString();\n  return isoStringTomorrow;\n}\n\nexport function validateEnv(baseUrl, keyIdType) {\n  if (!baseUrl) {\n    throw new Error(\"Please provide a baseUrl\");\n  }\n\n  const environment = Object.keys(keyPrefixes).find((env) =>\n    baseUrl.includes(env)\n  );\n\n  if (!environment) {\n    throw new Error(\"Unsupported baseUrl\");\n  }\n\n  const prefix = keyPrefixes[environment][keyIdType];\n\n  if (!prefix) {\n    throw new Error(`Unsupported keyIdType: ${keyIdType}`);\n  }\n\n  return prefix;\n}","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/juspay/hyperswitch/blob/9b8b89dc378b62c9a6feda647bad4719d2de7699/cypress-tests-v2/cypress/utils/RequestBodyUtils.js#L12-L48","documentation":"Thrown by validateEnv(baseUrl, keyIdType) in cypress-tests-v2/cypress/utils/RequestBodyUtils.js when the baseUrl argument is falsy. The function maps a base URL to the API key prefix used in request bodies (keyPrefixes covers localhost/integ/sandbox), so it refuses to run with no URL at all.","triggerScenarios":"Calling validateEnv('') , validateEnv(undefined) or validateEnv(null) — typically because the Cypress env that should hold the environment base URL (e.g. Cypress.env('baseUrl') or a BASE_URL variable) was never set for the run.","commonSituations":"Running cypress-tests-v2 without the required --env flags or without the env block in config; CI pipeline that injects the URL only for some jobs; typo in the env variable name so it reads undefined.","solutions":["Pass a real baseUrl, e.g. --env baseUrl=https://sandbox.hyperswitch.io when launching Cypress","Set the env in cypress.config / the CI environment so Cypress.env('baseUrl') resolves before tests call validateEnv","Fail fast at spec start with a clear message listing the missing env instead of deep inside request-body building"],"exampleFix":"// before\nconst prefix = validateEnv(Cypress.env('baseUrl'), 'publishable_key');\n\n// after\nconst baseUrl = Cypress.env('baseUrl');\nif (!baseUrl) throw new Error('Set CYPRESS_baseUrl (e.g. --env baseUrl=https://sandbox.hyperswitch.io)');\nconst prefix = validateEnv(baseUrl, 'publishable_key');","handlingStrategy":"validation","validationCode":"// At spec bootstrap, fail fast with all missing envs\nconst baseUrl = Cypress.env('baseUrl');\nif (!baseUrl) {\n  throw new Error(\n    `Missing baseUrl. Start cypress with --env baseUrl=https://sandbox.hyperswitch.io (env keys present: ${Object.keys(Cypress.env()).join(', ')})`\n  );\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Centralize env validation in support/e2e.js so it fails before tests, not inside request builders","Print available Cypress.env() keys in bootstrap errors to spot naming typos","CI: make the baseUrl env a required pipeline variable"],"tags":["cypress","configuration","environment","validation"],"backgroundTag":null,"analyzedSha":"9b8b89dc378b62c9a6feda647bad4719d2de7699","analyzedAt":"2026-08-16T09:01:53.433Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}