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

Login doesn't work when a specific other extension is installed #449

Closed
lumaxis opened this issue Sep 12, 2018 · 4 comments
Closed

Login doesn't work when a specific other extension is installed #449

lumaxis opened this issue Sep 12, 2018 · 4 comments
Assignees
Labels
authentication bug Issue identified by VS Code Team member as probable bug

Comments

@lumaxis
Copy link

lumaxis commented Sep 12, 2018

I think I might have stumbled over a very strange edge case. When installing a very specific other VS Code extension, login to github.com doesn't work. As soon as I disabled the docs-article-templates extension, sign in starts to work as expected.
To me, the stacktrace looks like a module resolution issue of one of the extension's dependencies but I haven't dug deeper into this.

  • Extension version: 0.1.3
  • VSCode Version: 1.28.0-insider
  • OS: macOS 10.13.6

Steps to Reproduce:

  1. Clone a github.com repo using the SSH option
  2. Install the docs-article-templates extension
  3. Try to sign in to GitHub with the extension:
Error signing in to github.com: TypeError: Cannot read property 'protocol' of undefined
TypeError: Cannot read property 'protocol' of undefined
    at Function.ClientRequestParser._getUrlFromRequestOptions (/Users/lukas/.vscode-insiders/extensions/docsmsft.docs-article-templates-0.1.2/node_modules/applicationinsights/AutoCollection/ClientRequestParser.js:111:62)
    at new ClientRequestParser (/Users/lukas/.vscode-insiders/extensions/docsmsft.docs-article-templates-0.1.2/node_modules/applicationinsights/AutoCollection/ClientRequestParser.js:23:45)
    at Function.AutoCollectClientRequests.trackRequest (/Users/lukas/.vscode-insiders/extensions/docsmsft.docs-article-templates-0.1.2/node_modules/applicationinsights/AutoCollection/ClientRequests.js:68:29)
    at Object.http.request (/Users/lukas/.vscode-insiders/extensions/docsmsft.docs-article-templates-0.1.2/node_modules/applicationinsights/AutoCollection/ClientRequests.js:37:43)
    at Object.request (https.js:239:15)
    at Object.<anonymous> (/Users/lukas/.vscode-insiders/extensions/shan.code-settings-sync-3.1.2/node_modules/agent-base/patch-core.js:23:20)
    at Object.n.request (/Users/lukas/.vscode-insiders/extensions/github.vscode-pull-request-github-0.1.3/media/extension.js:8:7222)
    at Object.n.get (/Users/lukas/.vscode-insiders/extensions/github.vscode-pull-request-github-0.1.3/media/extension.js:8:7266)
    at w.<anonymous> (/Users/lukas/.vscode-insiders/extensions/github.vscode-pull-request-github-0.1.3/media/extension.js:1:87622)
    at new w (/Users/lukas/.vscode-insiders/extensions/github.vscode-pull-request-github-0.1.3/media/extension.js:1:88782)
    at Promise (/Users/lukas/.vscode-insiders/extensions/github.vscode-pull-request-github-0.1.3/media/extension.js:1:94569)
    at new Promise (<anonymous>)
    at g.start (/Users/lukas/.vscode-insiders/extensions/github.vscode-pull-request-github-0.1.3/media/extension.js:1:94532)
    at t.GitHubServer.<anonymous> (/Users/lukas/.vscode-insiders/extensions/github.vscode-pull-request-github-0.1.3/media/extension.js:1:96950)
    at Generator.next (<anonymous>)
    at /Users/lukas/.vscode-insiders/extensions/github.vscode-pull-request-github-0.1.3/media/extension.js:1:94188
    at new Promise (<anonymous>)
    at i (/Users/lukas/.vscode-insiders/extensions/github.vscode-pull-request-github-0.1.3/media/extension.js:1:93965)
    at t.GitHubServer.login (/Users/lukas/.vscode-insiders/extensions/github.vscode-pull-request-github-0.1.3/media/extension.js:1:96873)
    at t.CredentialStore.<anonymous> (/Users/lukas/.vscode-insiders/extensions/github.vscode-pull-request-github-0.1.3/media/extension.js:8:22323)
    at Generator.next (<anonymous>)
    at o (/Users/lukas/.vscode-insiders/extensions/github.vscode-pull-request-github-0.1.3/media/extension.js:8:20583)
    at <anonymous>
@RMacfarlane RMacfarlane added authentication bug Issue identified by VS Code Team member as probable bug labels Sep 12, 2018
@shana
Copy link
Contributor

shana commented Sep 13, 2018

Oh weird. It looks like the applicationInsights package is breaking things. Maybe this is why other people can't login either...

@shana
Copy link
Contributor

shana commented Sep 13, 2018

I can repro this locally, and this is because docs-articles-templates is using version 0.18 of the ApplicationInsights-nodejs package, when that package's latest release is 1.0.4 and has been mostly rewritten (0.18 is more than a year old). Application Insights looks to be intercepting all requests and parsing the request.

It throws on this line: https://github.com/Microsoft/ApplicationInsights-node.js/blob/8d2ce986914d77cd629a1bc5ee477a8d79a23d6f/AutoCollection/ClientRequestParser.ts#L123 - request.agent is undefined in this particular request.

This is likely the root cause of #384 and #403 - there might other packages out there using old versions of application insights, breaking things. I'm trying to figure out if there's some extra data I can pass in to the request that will make this code not throw.

Thanks for the spelunking @lumaxis, very nice catch!

@shana
Copy link
Contributor

shana commented Sep 13, 2018

microsoft/vscode-docs-authoring#100 opened upstream.

@lumaxis
Copy link
Author

lumaxis commented Sep 13, 2018

@shana Sure thing but the new error logging made this pretty easy to track down 😉 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authentication bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants