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

Build fails to download external dependencies because sync-request module is hopelessly out of date #11136

Closed
IanKemp opened this issue Aug 16, 2019 · 17 comments

Comments

@IanKemp
Copy link

IanKemp commented Aug 16, 2019

For example, ArchiveFilesV2:

C:\Work\GitHub\IanKemp\azure-pipelines-tasks> node make.js build

<thousands of lines of output skipped>

------------------------------------------------------------
Building: ArchiveFilesV2
------------------------------------------------------------

> getting task externals
Downloading file: https://vstsagenttools.blob.core.windows.net/tools/7zip/1/7zip.zip
C:\Work\GitHub\IanKemp\azure-pipelines-tasks\node_modules\sync-request\index.js:27
    throw new Error(res.stderr.toString());
    ^

Error
    at doRequest (C:\Work\GitHub\IanKemp\azure-pipelines-tasks\node_modules\sync-request\index.js:27:11)
    at downloadFile (C:\Work\GitHub\IanKemp\azure-pipelines-tasks\make-util.js:384:22)
    at downloadArchive (C:\Work\GitHub\IanKemp\azure-pipelines-tasks\make-util.js:424:27)
    at C:\Work\GitHub\IanKemp\azure-pipelines-tasks\make-util.js:617:33
    at Array.forEach (<anonymous>)
    at getExternals (C:\Work\GitHub\IanKemp\azure-pipelines-tasks\make-util.js:612:25)
    at C:\Work\GitHub\IanKemp\azure-pipelines-tasks\make.js:189:13
    at Array.forEach (<anonymous>)
    at Function.target.build (C:\Work\GitHub\IanKemp\azure-pipelines-tasks\make.js:154:14)
    at Object.global.target.<computed> [as build] (C:\Work\GitHub\IanKemp\azure-pipelines-tasks\node_modules\shelljs\make.js:28:26)

Similar issue with AzureAppServiceManageV0, I didn't check any others.

Important to note that manually downloading the specified ZIP files succeeds.

I am not behind a proxy.

@ghost ghost added route triage labels Aug 16, 2019
@IanKemp IanKemp changed the title Tasks with external build dependencies cannot download those dependencies Build fails to download external dependencies Aug 16, 2019
@IanKemp
Copy link
Author

IanKemp commented Aug 16, 2019

Seems like there is a bug or issue in the sync-request module, after editing its index.js file to spit out useful diagnostic info:

  var res = spawnSync(process.execPath, [require.resolve('./lib/worker.js')], {input: req});
  if (res.status !== 0) {
    throw new Error("Expected status 0, got " + res.status + ": " + res.stderr.toString());
  }

I get:

> getting task externals
Downloading file: https://vstsagenttools.blob.core.windows.net/tools/7zip/1/7zip.zip
C:\Work\GitHub\IanKemp\azure-pipelines-tasks\node_modules\sync-request\index.js:27
    throw new Error("Expected status 0, got " + res.status + ": " + res.stderr.toString());
    ^

Error: Expected status 0, got null:
    at doRequest (C:\Work\GitHub\IanKemp\azure-pipelines-tasks\node_modules\sync-request\index.js:27:11)
    at downloadFile (C:\Work\GitHub\IanKemp\azure-pipelines-tasks\make-util.js:384:22)
    at downloadArchive (C:\Work\GitHub\IanKemp\azure-pipelines-tasks\make-util.js:424:27)
    at C:\Work\GitHub\IanKemp\azure-pipelines-tasks\make-util.js:617:33
    at Array.forEach (<anonymous>)
    at getExternals (C:\Work\GitHub\IanKemp\azure-pipelines-tasks\make-util.js:612:25)
    at C:\Work\GitHub\IanKemp\azure-pipelines-tasks\make.js:189:13
    at Array.forEach (<anonymous>)
    at Function.target.build (C:\Work\GitHub\IanKemp\azure-pipelines-tasks\make.js:154:14)
    at Object.global.target.<computed> [as build] (C:\Work\GitHub\IanKemp\azure-pipelines-tasks\node_modules\shelljs\make.js:28:26)

So res.status is null but the module is expecting it to be zero.

@IanKemp IanKemp changed the title Build fails to download external dependencies Build fails to download external dependencies because sync-request module is hopelessly out of date Aug 16, 2019
@IanKemp
Copy link
Author

IanKemp commented Aug 16, 2019

For some reason, package.json in this project uses version 3.0.1 of sync-request, which was released more than 3 years ago.... the latest version of this module is 6.1.0.

The issue I'm encountering is documented in the sync-request repo: ForbesLindesay/sync-request#81 and was fixed by them.

I attempted to upgrade the version of sync-request to 5.0.0 but this threw hundreds of TypeScript errors because, for equally inexplicable reasons, this project locks its version of TypeScript to the equally-ancient 2.3.4.

I then attempted to upgrade TypeScript to get around this, but that caused all sorts of errors further down the build pipeline. So I then used the nuclear option and updated every Node package to its latest version, but that also caused things to break.

Honestly this is an embarrassment of note. If you're going to use Node and its ecosystem, do it properly and keep things updated! The situation of the build process in this repo is shocking and reflects extremely poorly on Azure itself, and honestly makes me wonder exactly how reliable Azure is.

Fix it.

@mattsteinRRD
Copy link

I too am running into this and would like to use recent versions of everything. Is there an ETA for this?

@hacst
Copy link

hacst commented Sep 30, 2019

Same here. Looks like this code is no longer compatible with current node stable versions. Using an old v11.15.0 node things work. Using a current 12.11.0 it fails with this error.

@lukka
Copy link
Member

lukka commented Dec 17, 2019

@aarondandy
Copy link
Contributor

This also prevented me from contributing. Is there any easy workaround for this issue?

@eriksteinebach
Copy link

Running into this as well. So if I understand correctly, the only way to build azure-pipeline-tasks locally is to downgrade node? Is there a simple way to do this?

@satbai
Copy link
Contributor

satbai commented Mar 10, 2020

Hello @stephenmichaelf, is there an update on the ETA of this issue? Thanks!

@SVronskiy
Copy link

SVronskiy commented Apr 2, 2020

Same here, please fix it. Not able to build HelmInstallerV1 for on-premises Devops 2019.

@rdtechie
Copy link

It should be fixed yes; but the issue is somewhere in the combination of nodejs and sync-request. I encountered the same issue when trying to build the AzurePowerShellV5 task.

For me it started to work after I installed nodejs v8.17.0 and npm v6.9.0.

mindlessroman pushed a commit to mindlessroman/azure-pipelines-tasks that referenced this issue Sep 16, 2020
Issue microsoft#11136 Points out that sync-request is way more up-to-date than 3.0.1

Is there any reason not to advance the version for this library?
@mindlessroman
Copy link
Member

For anyone following this still. It seems that a PR is in the works to bump this version up for sync-request. microsoft/azure-pipelines-task-lib#665

@github-actions
Copy link

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

@github-actions github-actions bot added the stale label Mar 17, 2021
@mattsteinRRD
Copy link

Is the PR for this done?

@github-actions github-actions bot removed the stale label Mar 17, 2021
@walliski
Copy link

walliski commented May 21, 2021

I wanted to contribute a bit, but cannot build the PublishTestresultsV2 task due to this error. Failed on Nodejs v14.17.0 (Current LTS). Haven't yet tried downgrading to older npm versions, but lets see.

Edit: At least node 8 seems to work, which is horribly old.

@mindlessroman
Copy link
Member

@walliski - I believe the recommended Node version is 10? https://docs.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops#prerequisites Though you may have seen this.

@stephenmichaelf stephenmichaelf removed their assignment Jun 22, 2021
@github-actions
Copy link

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

@maltevesper
Copy link

The bot might have closed it, but I still cant build this. (Or find a release which I dare to build, since the last release is almost three years old)...

The CI is unhappy too....
image

...will this ever be fixed?

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