{"record":{"id":"f5c7801185ab4034","repo":"juspay/hyperswitch","slug":"invalid-config-missing-path","errorCode":null,"errorMessage":"Invalid config: missing path","messagePattern":"Invalid config: missing path","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cypress-tests/cypress/e2e/configs/Payment/Utils.js","lineNumber":834,"sourceCode":"};\n\n// Helper functions\nexport const shouldExcludeConnector = (connectorId, list) => {\n  return Array.isArray(list) && list.includes(connectorId);\n};\n\nexport const shouldIncludeConnector = (connectorId, list) => {\n  if (!Array.isArray(list)) return true;\n  return !list.includes(connectorId);\n};\n\nexport function setNormalizedValue(\n  webhookBody,\n  config,\n  connectorTransactionID\n) {\n  if (!config?.path) {\n    throw new Error(\"Invalid config: missing path\");\n  }\n  // Split the dot-separated path into individual keys\n  const keys = config.path.split(\".\");\n  let target = webhookBody;\n\n  // Traverse the object until the parent of the final key\n  for (const key of keys.slice(0, -1)) {\n    if (!Object.prototype.hasOwnProperty.call(target, key)) {\n      throw new Error(`Path does not exist: ${config.path}`);\n    }\n    target = target[key];\n  }\n  // The final key where the normalized value will be assigned\n  const finalKey = keys[keys.length - 1];\n\n  // Coerce value based on expected type\n  const normalizedconnectorTransactionID = coerceValue(\n    connectorTransactionID,","sourceCodeStart":816,"sourceCodeEnd":852,"githubUrl":"https://github.com/juspay/hyperswitch/blob/9b8b89dc378b62c9a6feda647bad4719d2de7699/cypress-tests/cypress/e2e/configs/Payment/Utils.js#L816-L852","documentation":"Thrown by setNormalizedValue in cypress-tests Payment/Utils.js when a webhook normalization config object lacks a truthy path property. The function writes a connector transaction id into a webhook body at config.path (dot-separated), so a missing path means it has nowhere to write and aborts.","triggerScenarios":"A spec's webhook normalization config passes { type: 'string' } or { } — i.e. an entry where the author omitted path — to setNormalizedValue while mutating an expected webhook body.","commonSituations":"Hand-editing webhook normalization entries in Payment configs; merging configs where a spread/omit accidentally drops path; new contributors copying a partial example.","solutions":["Add the required dotted path to the config entry, e.g. { path: 'data.body.id', type: 'string' }","Check for typos: it must be path (not paths / key / field)","Validate normalization configs in one place when the spec loads, so all missing-path entries are listed at once"],"exampleFix":"// before\nsetNormalizedValue(webhookBody, { type: 'string' }, connectorTxnId);\n\n// after\nsetNormalizedValue(webhookBody, { path: 'data.body.id', type: 'string' }, connectorTxnId);","handlingStrategy":"type-guard","validationCode":"// Validate all normalization configs when the spec loads\nconst invalid = normalizationConfigs.filter((c) => !c || typeof c.path !== 'string' || !c.path);\nif (invalid.length) {\n  throw new Error(`Webhook normalization configs missing 'path': ${JSON.stringify(invalid)}`);\n}","typeGuard":"/** @param {unknown} cfg @returns {cfg is { path: string, type?: 'string' | 'number' }} */\nfunction isNormalizationConfig(cfg) {\n  return Boolean(cfg) && typeof cfg === 'object' && typeof cfg.path === 'string' && cfg.path.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Author webhook normalization entries with both path and type from a shared example","Validate config shape once at load time rather than per webhook","The property is 'path' — not 'paths', 'key', or 'field'"],"tags":["cypress","webhook","configuration","validation"],"backgroundTag":null,"analyzedSha":"9b8b89dc378b62c9a6feda647bad4719d2de7699","analyzedAt":"2026-08-16T09:01:53.433Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}