{"record":{"id":"9a34c93b186444d2","repo":"juspay/hyperswitch","slug":"path-does-not-exist-config-path","errorCode":null,"errorMessage":"Path does not exist: ${config.path}","messagePattern":"Path does not exist: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cypress-tests/cypress/e2e/configs/Payment/Utils.js","lineNumber":843,"sourceCode":"  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,\n    config.type\n  );\n\n  target[finalKey] = normalizedconnectorTransactionID;\n}\n\nfunction coerceValue(value, type) {\n  switch (type) {\n    case \"string\":","sourceCodeStart":825,"sourceCodeEnd":861,"githubUrl":"https://github.com/juspay/hyperswitch/blob/9b8b89dc378b62c9a6feda647bad4719d2de7699/cypress-tests/cypress/e2e/configs/Payment/Utils.js#L825-L861","documentation":"Thrown by setNormalizedValue in Payment/Utils.js when traversing the dot-separated config.path over the webhook body: for every key except the last, the target object must own that property (Object.prototype.hasOwnProperty check). If any intermediate key is missing — e.g. 'data' or 'body' while walking 'data.body.id' — it throws with the full path.","triggerScenarios":"A normalization config says 'data.body.transaction_id' but the connector's webhook body actually nests the id at 'data.object.id' or similar; or the webhook fixture used for the test does not include the intermediate object, so hasOwnProperty fails mid-walk.","commonSituations":"Connector webhook payload shape changed (new API version) while test configs kept the old path; path authored for a different connector's webhook format; fixture data pruned during refactoring removing intermediate nodes.","solutions":["Log/inspect the actual webhook body (its JSON structure) and correct config.path to match where the transaction id really lives","Keep per-connector normalization configs — do not reuse one connector's path for another","If the connector payload changed, update both the fixture and the normalization path in the same commit"],"exampleFix":"// before\nsetNormalizedValue(webhookBody, { path: 'data.body.id', type: 'string' }, txnId);\n// throws: Path does not exist: data.body.id  (body nests under data.object)\n\n// after\nsetNormalizedValue(webhookBody, { path: 'data.object.id', type: 'string' }, txnId);","handlingStrategy":"validation","validationCode":"// Pre-check a dotted path against the webhook body (mirrors the util's walk)\nfunction pathExists(body, dottedPath) {\n  let target = body;\n  for (const key of dottedPath.split('.').slice(0, -1)) {\n    if (!Object.prototype.hasOwnProperty.call(target, key)) return false;\n    target = target[key];\n    if (target === null || typeof target !== 'object') return false;\n  }\n  return true;\n}\nif (!pathExists(webhookBody, config.path)) {\n  throw new Error(`Webhook fixture lacks path ${config.path} — fix fixture or path for connector ${connectorId}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Log the actual webhook body next to the configured path when authoring normalization configs","Update path and fixture together when a connector's webhook schema changes","Never reuse one connector's path for another connector's webhook shape"],"tags":["cypress","webhook","configuration","data-shape"],"backgroundTag":null,"analyzedSha":"9b8b89dc378b62c9a6feda647bad4719d2de7699","analyzedAt":"2026-08-16T09:01:53.433Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}