Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WikiUpdaterTask@2 - Cannot find module 'node:events' #1870

Closed
pak-sergey opened this issue May 1, 2024 · 9 comments
Closed

WikiUpdaterTask@2 - Cannot find module 'node:events' #1870

pak-sergey opened this issue May 1, 2024 · 9 comments

Comments

@pak-sergey
Copy link

Azure DevOps Extensions

WIKI Updater

Platform

Azure DevOps Services

Azure DevOps Server (TFS) Version

Windows Server 2016 Standard

Extension Version

2.14.4 (3.23.6)

Describe the bug

After 10 April 2024, when WIKI Updater Tasks extension was updated to version 3.23.6, the task started to fail on some environments.

The google search for error: Cannot find module 'node:events', give something about node.js, but node.js is not installed on others environments and it still works, but on some particulars environments it fails with the same script executed.

Please advise.

Repo Steps

steps:

  • task: WikiUpdaterTask@2
    displayName: 'Update Wiki Release notes - ${{ parameters.currentDate }}'
    inputs:
    repo: 'https://xxx/yyy/_git/Release-Notes.wiki'
    branch: 'master'
    filename: '${{ parameters.wikiFileName }}'
    replaceFile: '${{ parameters.wikiReplaceFile }}'
    appendToFile: '!${{ parameters.wikiReplaceFile }}'
    dataIsFile: true
    sourceFile: '${{ parameters.outputFileName }}'
    message: '${{ parameters.wikiCommitMessage }} - ${{ parameters.currentDate }}'
    gitname: 'user'
    gitemail: 'user@yahoo.com'
    useAgentToken: true
    localpath: '${{ parameters.LocalPath }}'

Expected Behavior

No response

Logging Information

Starting: Update Wiki Release notes - 2024-05-01T15:39:48

Task : Git based WIKI Single File Updater from Black Marble
Description : A tools to update or create a file in a WIKI based in a Git repo
Version : 2.14.4
Author : Richard Fennell
Help : Version: #{Build.BuildNumber}#. More Information

##[error]Unhandled: Cannot find module 'node:events'
##[error]Error: Cannot find module 'node:events'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at src/lib/plugins/plugin-store.ts (C:\azagent\A3_work_tasks\WikiUpdaterTask_e59c5ae6-3afd-479d-bc40-81cd6c541840\2.14.4\node_modules\simple-git\dist\cjs\index.js:1465:26)
at __init (C:\azagent\A3_work_tasks\WikiUpdaterTask_e59c5ae6-3afd-479d-bc40-81cd6c541840\2.14.4\node_modules\simple-git\dist\cjs\index.js:26:56)
at src/lib/plugins/index.ts (C:\azagent\A3_work_tasks\WikiUpdaterTask_e59c5ae6-3afd-479d-bc40-81cd6c541840\2.14.4\node_modules\simple-git\dist\cjs\index.js:1628:5)
at __init (C:\azagent\A3_work_tasks\WikiUpdaterTask_e59c5ae6-3afd-479d-bc40-81cd6c541840\2.14.4\node_modules\simple-git\dist\cjs\index.js:26:56)
at src/lib/git-factory.ts (C:\azagent\A3_work_tasks\WikiUpdaterTask_e59c5ae6-3afd-479d-bc40-81cd6c541840\2.14.4\node_modules\simple-git\dist\cjs\index.js:4754:5)
at __init (C:\azagent\A3_work_tasks\WikiUpdaterTask_e59c5ae6-3afd-479d-bc40-81cd6c541840\2.14.4\node_modules\simple-git\dist\cjs\index.js:26:56)
Finishing: Update Wiki Release notes - 2024-05-01T15:39:48

@rfennell
Copy link
Owner

rfennell commented May 3, 2024

Can I confirm where you are trying to run this task - is it the AZDO Services (Cloud) or a Server (On premised). If the latter which version of AZDO Server are you using. Also are you using Microsoft Host Build agents or private agents?

I have not experienced with error in either my automated testing, or in any of the pipelines I use which all make use of this task

The change to the code around the 10th Apr was to fix a regression a previous update had cause. You can see the shipped versions and download VSIX for use on on premise AZDO Server instances

@pak-sergey
Copy link
Author

pak-sergey commented May 3, 2024

It's used on premised Server Windows Server 2016 Standard, it's private agents. It's used on 3 different pipeline and the Task run after deployment on different Servers. From 7 Servers, it fails only on 2 of them.
image

The WikiUpdaterTask I believe installed by Pipeline:
image

I can try to install latest VSIX, but on 5 others Servers it still works without this step.

@rfennell
Copy link
Owner

rfennell commented May 4, 2024

The installation of the VSIX is done automatically by AZDO as part of the running of a pipeline for minor or patch updates (using semver format MAJOR.MINOR.PATCH). So you only have to alter your pipeline to change the major version.

So the question has to be what is the difference in setup on the 2 failing server? Do they have different versions of Node installed?

@pak-sergey
Copy link
Author

As it was wrote in description, there is no any Node installed on any of these servers and it still works of 5 others Servers. I agree that 2 failing servers should have something different, but can"t find what it can be. And before last update of the Task, it worked on all of these Servers.

@nobba
Copy link

nobba commented May 13, 2024

Same problem for us with version 2.14.4. Also on-prem, Azure DevOps Server 2022.0.1.

@rfennell
Copy link
Owner

Node is installed on an agent when the Azure DevOps agent is installed. The version of Node is dependant on the version of the Azure DevOps agent. If you look your agent's external folder you (amongst other folders) will see some of

  • Node (this is Node 6)
  • Node10
  • Node16
  • Node20_1 (only present on V3.x agents)

image

Is it possible you have different agent versions on different VMs? (Though this seems unlikely as the agent binaries are managed by the Azure DevOps Server)

@nobba
Copy link

nobba commented May 15, 2024

Ok, I thought that the Task would use any of the node versions available in "..\work\_tool\node" folder? In the externals folder we only have "node" and "node10", so would that perhaps explain the issue in our case?

@rfennell
Copy link
Owner

In the version of node to be used depends on the task.json file (which you can find in this repo or on a build agent in the <agent>\_work\_tasks\WikiUpdaterTask_e59c5ae6-3afd-479d-bc40-81cd6c541840\<version> folder.

At the end of the file you will find the execution block that defines the Node version to use

For the 3.x WikiUpdater task it contains

"execution": {
      "Node16": {
      "target": "GitWikiTask.js",
      "argumentFormat": ""
    }

For the 2.*

  "instanceNameFormat": "Git based WIKI File Updater",
        "execution": {
                "Node10": {
                        "target": "GitWikiTask.js",
                        "argumentFormat": ""
                }
        }

Note for some tasks there could be multiple execution blocks supporting Node, Node10, Node16 and various PowerShell options - it depends what is packaged in the task

@nobba
Copy link

nobba commented Jun 5, 2024

We had an old version of the release pipeline agent, updating that and using latest version of the task worked. Thank you!

@rfennell rfennell closed this as completed Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants