v4 throws an error "Cannot read properties of undefined (reading 'retrieveSecret')"
jessehouwing opened this issue · 3 comments
jessehouwing commented
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));
jessehouwing commented
Roman-Shchukin commented
It looks like a library version conflict. In the pipeline tasks this is solved as follows https://github.com/microsoft/azure-pipelines-tasks/pull/17222/files#diff-a47a4c679593fd7fd921514d60e0ba669681ce937dab37845f359cddd0a9a22e
jessehouwing commented
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.