Skip to content

[BUG]: Failed rmRF: fs.rmSync is not a function in CopyFilesV2 with old agents #21027

Open
@ellull

Description

@ellull

New issue checklist

Task name

CopyFiles

Task version

2.254.0

Issue Description

Recently the CopyFilesV2 task has been updated in our hosted agents to version 2.254.0 and some of the agents where failing in the CopyFilesV2 task, which previously worked.

After some investigation we've found that the task is failing when executed in very old versions of the agent (2.202.1, for example).

Digging deeper, we have found that the task.json of the CopyFilesV2 tasks states that the minimum agent version is 2.182.1, which is less than the version of the agents where the task is failing (2.202.1) but the CopyFilesV2 v2.254.0 depends on azure-pipelines-task-lib v5.2.0, from with it uses the rmRF function. And the rmRF function of azure-pipelines-task-lib uses the function rmSync which was added in node v14.14.0.

So, I think that the minimumAgentVersion should be updated to 2.206.1 as the CopyFilesV2 task needs at least node 14 to work because azure-pipelines-task-lib uses the function rmSync and the agent v2.206.1 is the first version which included the node16 execution handler.

Also, the execution > Node10 configuration in the task.json should be also removed because this task will fail if node version is below v14.

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Ubuntu 16.04

Relevant log output

2025-05-15T08:44:22.1133674Z ##[section]Starting: Copy Files to: /opt/copyfiletest
2025-05-15T08:44:22.1139046Z ==============================================================================
2025-05-15T08:44:22.1139249Z Task         : Copy files
2025-05-15T08:44:22.1139460Z Description  : Copy files from a source folder to a target folder using patterns matching file paths (not folder paths)
2025-05-15T08:44:22.1139666Z Version      : 2.254.0
2025-05-15T08:44:22.1139824Z Author       : Microsoft Corporation
2025-05-15T08:44:22.1140007Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/copy-files
2025-05-15T08:44:22.1140236Z ==============================================================================
2025-05-15T08:44:22.9258835Z found 1 files
2025-05-15T08:44:22.9260329Z Cleaning target folder: /opt/copyfiletest
2025-05-15T08:44:22.9297662Z ##[error]Error: Failed rmRF: fs.rmSync is not a function
2025-05-15T08:44:22.9312947Z ##[section]Finishing: Copy Files to: /opt/copyfiletest

Full task logs with system.debug enabled

tasklog_5.log

Repro steps

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions