I am trying to use tesseract.js inside the N8N. I have installed and exported the tesseract in the NODE_ALLOWED environment variable and it’s all fine. I have the code in my VS code and executed the code via N8N execute node and i am getting the expected result. What i am trying is how i can make the code to be used by a function Node instead of execute Node. Please find the code below and kindly suggest how i can use this code inside function node…
Details
Stack
TypeError: Cannot read property 'every' of undefined
at Object.normalizeItems (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/NodeExecuteFunctions.js:752:23)
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Function/Function.node.js:97:34)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:454:47
That looks like something is undefined although I am not sure what, I will set aside some time next week to have a proper look. If it was me though I would probably look at making it a custom node as it would give you a bit more control.
Thanks, i have no idea as to how to make this as a custom node and most importantly, the code is working find when i use execute node and even in my vscode. This undefined is only when i try this code on a function node.
Yes, that’s what I did and it’s working perfectly fine, but what I am trying to achive is to remove the execute node and use a function node to directly call the code…This gives me more flexibility and I don’t have to maintain the code as a file inside the containers…
The function node it’s already wrapped with an async, so no need for the one if the example. Also, you need to return an object, not only the text as you did above. it should be: