[Function] [Error] Function Node not running due to "unexepected character" from a non-existent line

Describe the issue/error/question

I’m trying to run a custom function built but I get a strange Error Unexpected Character line 96 (while my function only have 19 lines)

What is the error message (if any)?

ERROR: Unexpected character ‘​’ [Line 96]

There was a problem executing the workflow: “Unexpected character ‘​’ [Line 96]”

/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Function:3
​
^

SyntaxError: Unexpected character '​'
    at makeNiceSyntaxError (/usr/local/lib/node_modules/n8n/node_modules/vm2/lib/transformer.js:41:16)
    at transformer (/usr/local/lib/node_modules/n8n/node_modules/vm2/lib/transformer.js:84:8)
    at NodeVM.run (/usr/local/lib/node_modules/n8n/node_modules/vm2/lib/nodevm.js:413:17)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Function/Function.node.js:96:31)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:594:51)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:537:64

Please share the workflow

Input example

{

"company_name": "Testxxx",

"company_domain": "xxxxx",

"company_logo": "xxxxxx",

"company_id": "c04870b3-d9e8-4fb7-bffd-98b3686b7f5c",

"company_linkedin_id": "12345678910",

"company_linkedin_url": "xxxxxx",

"company_industry": "Information Technology and Services",

"company_staff_count": 19192,

"company_employee_range": "10001+",

"company_founded_year": 2010,

"company_tools": ".NET,C++,Power BI,SQL Server Reporting Services (SSRS),Microsoft Office 365,Azure,GitHub,PowerShell,Azure Devops,Exchange,Microsoft Dynamics AX,Welcome to the jungle,Salesforce,Outlook,Atlassian,DocuSign,Apple Business Manager,Zoom,Dmarc,Flickity,Google Tag Manager,Cdnjs,OWL Carousel,Unpkg,Font Awesome,GSAP,Twitter,Onetrust,JQuery UI,Bootstrap,JQuery,Choices,Microsoft SQL Server,SQL Server Integration Services (SSIS),SQL Server Analysis Services (SSAS),azure datalake,Informatica,Tableau,AngularJS,JIRA,Azure Databricks,Microsoft SharePoint,ASP.NET,React JS,JavaScript,TypeScript,Azure Data Factory,Vue.js,Avanade,Go,Microsoft,YouTube,Facebook,Instagram,Dynamics 365,Microsoft Dynamics 365,Microsoft Dynamics,Microsoft Azure,Sitecore,Angular,Kubernetes,React,Gulp,Npm,SCSS,Webpack,Netcore,API REST,Azure Functions,Azure Pipelines,Git,Kafka,NoSQL,React Native,ASP.NET MVC,Azure PaaS,Excel,SAP",

"company_labels": "AI, SaaS",

"company_follower_count": 362629,

"company_address": "xxxxx",

"company_specialities": [

"IT Services",

"Microsoft Dynamics",

"Microsoft",

"SharePoint",

"CRM",

"Cloud Computing",

"Dynamics 365",

"Technology Infrastructure",

"Application Development",

"ERP",

"Digital Transformation",

"Security",

"Customer Experience",

"Supply Chain Management",

"Sustainability",

"Innovation",

"Technology",

"Microsoft Azure",

"Microsoft Power Platform",

"Microsoft Industry Clouds",

"Agile Delivery",

"Microsoft Teams",

"Windows 10",

"Analytics and AI",

"Business Consulting",

"Modern Workplace",

"Managed Services",

"Research",

"Advisory"

],

"company_tagline": "xxxxx",

"company_hashtags": [

"xxxx",

"xxxx"

],

"company_description": "xxxxx",

"matched_job_offers_company_count": 1,

"job_offers": [

{

"job_id": "b335522558808c-2148-4b65-b97b-54fffbc34724",

"job_name": "xxxx",

"job_contract": "Jornada completa",

"job_location": "xxxxx",

"job_categories": "Business",

"job_level": "Individual contributor",

"job_published_at": "2022-08-01T00:00:00.000Z",

"job_description": "xxxx",

"workflow_keywords": ""

}

],

"people_first_name": "xxxxx",

"people_last_name": "xxxxx",

"people_full_name": "xxxxx",

"people_current_position": "Senior Director Sales & Alliances",

"people_linkedin_url": "xxxxxx",

"people_company_domain": "xxx",

"people_company_name": "xxxx",

"people_buying_signals_id": "c258808c-2148-4b65-b97b-54fffbc34724",

"people_buying_signals_title": "Sales Enablement Specialist",

"source": "xxx",

"workflow": "00327f3d-806d-4eed-9c75-e5253df3b252"

}

Expected Output

“crm” = “Salesforce”

Information on your n8n setup

  • **n8n version:latest stable
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [n8n.cloud]:

Thanks for your help, I hope the ticket is clear enough.

@n8n_Team I feel like it might come from our cloud instance ? Thanks for your assistance

Hi @Vincent_Bonjean,
I fixed your Function Node be removing all empty lines and adding them again and now it works. Seems like there was a special hidden character somewhere in the empty lines. Does the following work for you?

Hello @marcus, Is this from the source I copied it in your opinion?

However, it works perfectly thanks :slight_smile:

Yes, that would be my best guess :grin: