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

azure-pipelines-task-lib 5.0.0 is failing on (reading 'retrieveSecret') #1093

Open
mikebijl opened this issue Feb 6, 2025 · 1 comment
Open

Comments

@mikebijl
Copy link

mikebijl commented Feb 6, 2025

We developed our own extension task with a dependency on:

  • "azure-pipelines-task-lib": "4.17.3",
  • "azure-pipelines-tasks-azure-arm-rest": "3.249.1",

but as soon as we update to:

  • "azure-pipelines-task-lib": "5.0.0",
  • "azure-pipelines-tasks-azure-arm-rest": "3.252.2",

we receive the error message:

Error Stack: TypeError: Cannot read properties of undefined (reading 'retrieveSecret')

We use the getAzureEndpoint function to retrieve the token of the service connection to connect to azure, the same way as AzurePowershellV5 does let endpointObject= await new AzureRMEndpoint(serviceName).getEndpoint();

Note: AzurePowershellV5 does not have the issue yet, since the latest version is published a while ago and is not depending on the versions of the packages mentioned above. But a republish should result in the similar issue.

We tried to get to the root cause but we were not able to point to the exact issue, I guess there is a relation with the decommissioning of AzureRM and the TLS 1.0/1.1, but that is just a guess.

Full message in debug mode:

##[debug]Get Azure Endpoint
##[debug]USE_MSAL=true
##[debug]MSAL - USE_MSAL override is found: true
Wrapper Execution Failed: Cannot read properties of undefined (reading 'retrieveSecret')
Error Stack: TypeError: Cannot read properties of undefined (reading 'retrieveSecret')
    at Object.getEndpointAuthorizationScheme (/home/vsts/work/_tasks/*****/node_modules/azure-pipelines-tasks-azure-arm-rest/node_modules/azure-pipelines-task-lib/task.js:447:32)
    at AzureRMEndpoint.<anonymous> (/home/vsts/work/_tasks/*****/node_modules/azure-pipelines-tasks-azure-arm-rest/azure-arm-endpoint.js:52:45)
    at Generator.next (<anonymous>)
    at /home/vsts/work/_tasks/*****/node_modules/azure-pipelines-tasks-azure-arm-rest/azure-arm-endpoint.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/vsts/work/_tasks/*****/node_modules/azure-pipelines-tasks-azure-arm-rest/azure-arm-endpoint.js:4:12)
    at AzureRMEndpoint.getEndpoint (/home/vsts/work/_tasks/*****/node_modules/azure-pipelines-tasks-azure-arm-rest/azure-arm-endpoint.js:32:16)
    at /home/vsts/work/_tasks/*****/dist/wrapper.js:2:1490785
    at /home/vsts/work/_tasks/*****/dist/wrapper.js:2:1490824
Error Name: TypeError
Full Error: TypeError: Cannot read properties of undefined (reading 'retrieveSecret')
@bonddim
Copy link

bonddim commented Feb 20, 2025

@mikebijl, got the same error on my task.
it seems that commonjs import fixes the problem:

import task = require("azure-pipelines-task-lib/task");

Upd:
Unfortunately, no - got error on setResult

2025-02-20T20:51:16.1607504Z ##[debug]Using node path: /home/vsts/agents/4.251.0/externals/node20_1/bin/node
2025-02-20T20:51:18.2108980Z ##[debug]system.debug=true
2025-02-20T20:51:18.2113255Z ##[debug]DistributedTask.Tasks.Node.SkipDebugLogsWhenDebugModeOff=True
2025-02-20T20:51:18.2180458Z ##[debug]agent.TempDirectory=/home/vsts/work/_temp
2025-02-20T20:51:18.2197321Z ##[debug]loading inputs and endpoints
2025-02-20T20:51:18.2207999Z ##[debug]loading INPUT_VERSION
2025-02-20T20:51:18.2345411Z ##[debug]loading INPUT_OPTIONS
2025-02-20T20:51:18.2354256Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2025-02-20T20:51:18.2361064Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2025-02-20T20:51:18.2367323Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2025-02-20T20:51:18.2385742Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
2025-02-20T20:51:18.2393051Z ##[debug]loaded 6
2025-02-20T20:51:18.2404223Z ##[debug]Agent.ProxyUrl=undefined
2025-02-20T20:51:18.2409652Z ##[debug]Agent.CAInfo=undefined
2025-02-20T20:51:18.2414146Z ##[debug]Agent.ClientCert=undefined
2025-02-20T20:51:18.2418784Z ##[debug]Agent.SkipCertValidation=undefined
2025-02-20T20:51:18.3384166Z ##[debug]Agent.ProxyUrl=undefined
2025-02-20T20:51:18.3387117Z ##[debug]Agent.CAInfo=undefined
2025-02-20T20:51:18.3390585Z ##[debug]Agent.ClientCert=undefined
2025-02-20T20:51:18.3392219Z ##[debug]check path : /home/vsts/work/_tasks/ArgoCDInstallerDev_07a3bd28-ae51-5e61-a7b3-6226fcd60701/0.1.12/node_modules/azure-pipelines-tool-lib/lib.json
2025-02-20T20:51:18.3393714Z ##[debug]adding resource file: /home/vsts/work/_tasks/ArgoCDInstallerDev_07a3bd28-ae51-5e61-a7b3-6226fcd60701/0.1.12/node_modules/azure-pipelines-tool-lib/lib.json
2025-02-20T20:51:18.3397800Z ##[debug]system.culture=en-US
2025-02-20T20:51:18.3416328Z ##[debug]task result: Failed
2025-02-20T20:51:18.3460031Z ##[error]Unhandled: Cannot read properties of undefined (reading 'setResult')
2025-02-20T20:51:18.3470928Z ##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;]Unhandled: Cannot read properties of undefined (reading 'setResult')
2025-02-20T20:51:18.3485722Z ##[debug]Processed: ##vso[task.complete result=Failed;]Unhandled: Cannot read properties of undefined (reading 'setResult')
2025-02-20T20:51:18.3489823Z ##[error]TypeError: Cannot read properties of undefined (reading 'setResult')
    at run (/home/vsts/work/_tasks/ArgoCDInstallerDev_07a3bd28-ae51-5e61-a7b3-6226fcd60701/0.1.12/dist/index.js:35:28)
    at Object.<anonymous> (/home/vsts/work/_tasks/ArgoCDInstallerDev_07a3bd28-ae51-5e61-a7b3-6226fcd60701/0.1.12/dist/index.js:117:1)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49
2025-02-20T20:51:18.3493520Z ##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;]TypeError: Cannot read properties of undefined (reading 'setResult')
    at run (/home/vsts/work/_tasks/ArgoCDInstallerDev_07a3bd28-ae51-5e61-a7b3-6226fcd60701/0.1.12/dist/index.js:35:28)
    at Object.<anonymous> (/home/vsts/work/_tasks/ArgoCDInstallerDev_07a3bd28-ae51-5e61-a7b3-6226fcd60701/0.1.12/dist/index.js:117:1)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49

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

2 participants