Fixing Object.hasOwn is not a function when updating Wappler

I just upgraded a rather old Wappler 5 project to Wappler 6, and upon deploy kept getting the error message Object.hasOwn is not a function, here is the full output of the error.

{
  "status": "500",
  "message": "Object.hasOwn is not a function",
  "stack": "TypeError: Object.hasOwn is not a function\n    at App.repeat (/opt/node_app/lib/modules/core.js:46:24)\n    at App._exec (/opt/node_app/lib/core/app.js:611:57)\n    at App._exec (/opt/node_app/lib/core/app.js:578:28)\n    at processTicksAndRejections (internal/process/task_queues.js:95:5)\n    at async App.exec (/opt/node_app/lib/core/app.js:547:9)\n    at async App.define (/opt/node_app/lib/core/app.js:529:9)"
}

After searching the Wappler community I could find no similar posts regarding the error, and started checking the rest of the web where I was lead to a report of Object.hasOwn requiring a minimum of NodeJS 16 to correctly run, I was on NodeJS 14, after updating my project settings and a redeploy all worked as expected again.

Just wanted to note it here on the community to save someone else from the mini heart attack.

2 Likes

Currently NodeJS 20 is the preferred version and 16 is the minimum version. Version 16 is also the minimum selectable within Wappler for new projects and if you update an old project it is always good to also update NodeJS to the latest version to have the latest security fixes and improved performance.

1 Like

Thanks for posting this Paul!! Had my mini heart attack already, but survived it thanks to you :smiley: