Extensions cannot be installed from a release definition
See original GitHub issueI am unable to install extensions from a release definition. If I do so, I get the following error:
D:\01\_work\_tools\tfx.cmd extension install --auth-type pat --token ********** --vsix "D:\01\_work\r9\a\myextension-1.0.6.gen.vsix" --service-url https://mytfsserver.com/tfs/MyCollection
TFS Cross Platform Command Line Interface v0.6.4
Copyright Microsoft Corporation
error: SyntaxError: Unexpected token < in JSON at position 2
After I enable debug logging I get more error logging:
2019-02-26T14:10:39.003Z : SyntaxError: Unexpected token < in JSON at position 2
2019-02-26T14:10:39.003Z : at JSON.parse (<anonymous>)
2019-02-26T14:10:39.003Z : at Function.<anonymous> (D:\01\_work\_tools\node_modules\tfx-cli\_build\exec\extension\in
stall.js:217:45)
2019-02-26T14:10:39.003Z : at step (D:\01\_work\_tools\node_modules\tfx-cli\_build\exec\extension\install.js:45:23)
2019-02-26T14:10:39.003Z : at Object.next (D:\01\_work\_tools\node_modules\tfx-cli\_build\exec\extension\install.js:
26:53)
2019-02-26T14:10:39.003Z : at fulfilled (D:\01\_work\_tools\node_modules\tfx-cli\_build\exec\extension\install.js:17
:58)
2019-02-26T14:10:39.003Z : at process._tickCallback (internal/process/next_tick.js:68:7)
The code that throws the error is on this line: https://github.com/Microsoft/tfs-cli/blob/457a7a320d84d9a732eb812232619d2940c2299d/app/exec/extension/install.ts#L182
The response in this case is an HTML page and not the expected JSON:
...
<h1>Error</h1>
<h2>The page you are looking for is currently unavailable.</h2>
<div id="errorMessage" style="font-size: 24px; color: #da0a00; margin-top: 30px; margin-bottom: 30px;">TF400813: Resource not available for anonymous access. Client authentication required.</div>
....
The function that is trowing the error in install.ts
does not do anything with authentication. It just requests the url https://mytfsserver.com/tfs/MyCollection/_apis/resourceareas/6c2b0933-3600-42ae-bf8b-93d4f7e83594
which in my case returns null
.
A workaround for this is to change this line: https://github.com/Microsoft/tfs-cli/blob/master/app/exec/extension/install.ts#L101
Into:
const serviceUrl = await this.commandArgs.serviceUrl.val();
My TFS instance version is 16.131.28507.4 (TFS 2018 Update 3.2)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top GitHub Comments
@jessehouwing @simondel : I created an own extension just for uploading FREE extensions to an Azure DevOps Server (OnPrem). I clarify with my boss if I can provide the full source code. Unfortunately it’s PS because my TS skillz are just read, not contribute… 😉
So far the core functions to make it work are:
Verified today. Install now workds. Thanks!