"Async" function issue in Azure DevOps Custom Extension Development

Mohamed Riaz 0 Reputation points
2023-09-28T05:13:55.5066667+00:00

I am new for Azure Custom DevOps extension. I have developed and extension and trying to use the same in Azure DevOps pipline. But facing issue as below.

"SyntaxError: Unexpected token function"

User's image

Checked for fix in the internet, many have suggested as the version of Node.js would be the issue. Hence I have added "Node.js tool installer" step also in the pipeline. But still the error is same.

Followed below links for the DevOps Custom Extension Development.

  1. https://video2.skills-academy.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops
  2. https://video2.skills-academy.com/en-us/azure/developer/javascript/how-to/with-azure-sdk/stop-start-virtual-machine

Note: I am able to run the Node.js application locally and getting the expected results.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,746 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Ommi Naveen Kumar 195 Reputation points Microsoft Vendor
    2023-09-28T05:47:10.9433333+00:00

    Hello @Mohamed Riaz

    Welcome to Microsoft Q&A Platform, thanks for posting your query here. Azure DevOps related queries/issues are currently not supported on this Microsoft Q&A platform.

    I would request you to please post your queries in dedicated forums as in below links:

    https://developercommunity.visualstudio.com/spaces/21/index.html

    https://developercommunity.visualstudio.com/t/get-unique-id-from-devops-organization/756710

    https://stackoverflow.com/questions/tagged/azure-devops

    0 comments No comments

  2. Rian Miguel Engracia 0 Reputation points
    2023-10-10T08:04:34.81+00:00

    @Mohamed Riaz have you found the solution for this? I'm getting the same error, thanks


  3. Jonasta dos Santos 0 Reputation points
    2023-10-19T13:25:34.5066667+00:00

    After spending half a day I found the solution for this problem:

    • 1st of all the problem is not clear at all: Whats happening is that the pipeline is using a old node version (7 probably) to run the extension - thats why modern syntax is not recognized
    • SOLUTION: update your task.json file as per below:
    "execution": {
        "Node16": {
          "target": "index.js"
        }
      }
    
    0 comments No comments