microsoft/azure-pipelines-task-lib

v4 throws an error "Cannot read properties of undefined (reading 'retrieveSecret')"

jessehouwing opened this issue · 3 comments

Please check our current Issues to see if someone already reported this https://github.com/Microsoft/azure-pipelines-task-lib/issues

Environment

azure-pipelines-task-lib version: 4.0.1-preview

Issue Description

Trying to run the following task:
https://github.com/microsoft/azure-devops-extension-tasks/blob/dev-v4/BuildTasks/TfxInstaller/TfxInstaller.ts

Expected behaviour

The task executes just fine

Actual behaviour

##vso[task.issue type=error;]Cannot read properties of undefined (reading 'retrieveSecret')

From what I can tell from the debugger the error happens here:

 20     return __awaiter(this, void 0, void 0, function* () {
 21         try {
>22             const version = taskLib.getInput("version", false);
 23             const checkLatest = taskLib.getBoolInput("checkLatest", false) || false;
 24             yield getTfx(version, checkLatest);
debug> s
break in node_modules\azure-pipelines-task-lib\task.js:203
 201  */
 202 function getInput(name, required) {
>203     var inval = im._vault.retrieveSecret('INPUT_' + im._getVariableKey(name));
 204     if (required && !inval) {
 205         throw new Error(exports.loc('LIB_InputRequired', name));

Here's the zipfile
task.zip

To run locally:

node tfxinstaller/tfxinstaller.js

The order of imports really seems to matter:

import * as taskLib from 'azure-pipelines-task-lib/task';
import * as toolLib from 'azure-pipelines-tool-lib/tool';

works.