Step
Calculator.
Message
Cannot read properties of undefined (Reading '{some variable}' ).
Cause
This error means that the calculator code is trying to access an object property that does not exist. For example, given an object.
jsx
const myObject = {
innerObject1: {
x: 1
}
}
const myX = myObject.innerObject1.x; // Valid, the given property exists
const myZ = myObject.innerObject3.z; // Invalid, innerObject2 is undefined.
// trying to read the value y from it
// results in the above error
Reading `myObject.innerObject1.x` is valid because the full path is valid.
Reading `myObject.innerObject3.z` is invalid because innerObject3 is undefined.
Trying to read the value `y` from it results in the above error.
Resolution
Use optional chaining to avoid errors. The following will throw an error if innerObject3 is undefined.
jsx
const myZ = myObject.innerObject3.z //
Try the following to resolve:
```jsx
const myZ = myObject.innerObject3?.z // Will not throw error, instead myZ will be null
if(myZ){
// do something with myZ
}else{
// myZ is undefined
}
```
Error Detail
{
"message": "Error running calculation", "statusCode": 400, "error": {}, "errorMessage": "input.parameters.hasOwnPropety is not a function" }, "errorMessage": "Error running calculation", "statusCode": 500, "stepType": "Mapper", "stepName": "Calculator", "stepId": "e61xxxxxx-xxxxx-4ec3-96c1-fxxxxxxxc", "mapStepId": "9yLJ8d1mR", "mapStepPath": "VYdxxxxxxx.VYdxxxxx.9yLJ8d1mR", "mapStepType": "Step", "module": "Basic" }