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

fix(downloadTool): drop abort to fix downloads #234

Open
riezebosch opened this issue Mar 14, 2024 · 0 comments · May be fixed by #235
Open

fix(downloadTool): drop abort to fix downloads #234

riezebosch opened this issue Mar 14, 2024 · 0 comments · May be fixed by #235

Comments

@riezebosch
Copy link

riezebosch commented Mar 14, 2024

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch azure-pipelines-tool-lib@2.0.7 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/azure-pipelines-tool-lib/tool.js b/node_modules/azure-pipelines-tool-lib/tool.js
index 48afe82..911bc89 100644
--- a/node_modules/azure-pipelines-tool-lib/tool.js
+++ b/node_modules/azure-pipelines-tool-lib/tool.js
@@ -234,11 +234,6 @@ function downloadTool(url, fileName, handlers, additionalHeaders) {
                             .on('error', (err) => {
                             file.end();
                             reject(err);
-                        })
-                            .on('aborted', () => {
-                            // this block is for Node10 compatibility since it doesn't emit 'error' event after 'aborted' one
-                            file.end();
-                            reject(new Error('Aborted'));
                         })
                             .pipe(file);
                     }

This issue body was partially generated by patch-package.

I was working on updating the dependency of my packerTool task and found out that for every test run the download would fail with the dreaded Aborted error. By patching your package it was consequently solved.

The event is also already deprecated for a while: https://nodejs.org/api/http.html#event-abort

Pretty sure it will fix these issues: microsoft/azure-pipelines-tasks#18280

@riezebosch riezebosch linked a pull request Mar 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant