Describe the problem/error/question
After updated to n8n version 1.39.1 we receiving severals TypeError: Cannot read properties of undefined, for some workflows.
I suspect the problem is when you try use do notation to access object properties.
For instance for the error attached, the error is on this line:
Shpping: inputData.total_shipping_price_set=== null? 0 : inputData.total_shipping_price_set.shop_money===null?0:(inputData.total_shipping_price_set.shop_money.amount),
the error is:
Cannot read properties of undefined (reading ‘shop_money’) [line 105, for item 0]
I verified this data is not null, so everything is OK. but n8n report an error.
How we can fix this?
What is the error message (if any)?
{
"errorMessage": "Cannot read properties of undefined (reading 'shop_money') [line 105, for item 0]",
"errorDescription": "TypeError",
"errorDetails": {},
"n8nDetails": {
"nodeName": "prepare Data1",
"nodeType": "n8n-nodes-base.code",
"nodeVersion": 2,
"itemIndex": 0,
"n8nVersion": "1.39.1 (Cloud)",
"binaryDataMode": "filesystem",
"stackTrace": [
"TypeError: Cannot read properties of undefined (reading 'shop_money')",
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code:105:95",
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code:171:2",
" at VM2 Wrapper.apply (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/bridge.js:485:11)",
" at NodeVM.run (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/nodevm.js:497:23)",
" at JavaScriptSandbox.runCodeEachItem (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/JavaScriptSandbox.js:97:45)",
" at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/Code.node.js:139:40)",
" at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:728:42)",
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:660:68",
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1062:20"
]
}
}
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
[workflow error](https://drive.google.com/file/d/19z-NL3WcGnwklm3lJHw8wqxGirtwZlaS/view?usp=sharing)
Share the output returned by the last node
Information on your n8n setup
- n8n version: 1.39.1
- Database (default: SQLite): NA
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): Cloud
- Operating system: Windows 11