How to apply a JavaScript Function to n8n?

Describe the issue/error/question

I want to use this JavaScript function in this link with n8n JavaScript: Chuyển tiếng Việt có dấu sang không dấu · GitHub

What is the error message (if any)?

I’ve added to a workflow but not successful like below workflow. Please help me how to do this?

Please share the workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 0.167.0
  • Database you’re using (default: SQLite): SQLite
  • Running n8n with the execution process [own(default), main]: own
  • Running n8n via [Docker, npm,, desktop app]: Docker

Hey @huuich,

That is a pretty old version of n8n now, Could be worth planning an upgrade at some point. Looking at your node you are not actually passing the string into the function so you would have to loop the items going into the Function node then calling your function passing in the data and returning it.

The below workflow has an example of that for you, The quick version is at the bottom of your Function node add…

// Loop items and run the function
for(item of items) {
    item.json.str = removeVietnameseTones(item.json.str);

// return data
return items;
1 Like

Thank you, it’s working now, I’ll find out to upgrade my n8n. I have some trouble when update to new version with user management. I’ve upgraded to 0.168.0 ok, but when upgrade to 0.195.0 has “user management and credential sharing for our Cloud platform” feature, my n8n site has some trouble. I’ll figure it and upgrade. Thanks.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.