sourcegraph / cody

Type less, code more: Cody is an AI code assistant that uses advanced search and codebase context to help you write and fix code.
https://cody.dev
Apache License 2.0
2.83k stars 308 forks source link

bug: VSCode remote - can't log in #2893

Open Miaourt opened 10 months ago

Miaourt commented 10 months ago

Version

1.85.2

Describe the bug

I'm working on a remote VSCode instance, on Linux from a MacOS host, and every time I try to log in (with the "sign in with *" buttons) I get greeted by a

Authentication failed. Please ensure Cody is enabled for sourcegraph.com and verify your email address if required.

Output logs:

█ CodyIgnore:updateCodyIgnoreCodespaceMap:codebase: gitlab.infra.online.net/storage/storage
█ CommandsController:fileWatcherInit: watchers created
█ AuthProvider:init:lastEndpoint: https://sourcegraph.com/
█ CodyIgnore:refresh:workspace: /root/storage
█ LocalEmbeddingsController: constructor
█ ChatManager:constructor: init has local embeddings controller
█ ChatPanelsManager:constructor: init
█ symf: downloading symf from https://github.com/sourcegraph/symf/releases/download/v0.0.2/symf-x86_64-linux-musl.zip
█ Symf: downloading from URL https://github.com/sourcegraph/symf/releases/download/v0.0.2/symf-x86_64-linux-musl.zip
█ CodyCompletionProvider:notSignedIn: You are not signed in.
█ SidebarViewController:onDidReceiveMessage: initialized
█ Cody:publishConfig: configForWebview 
█ ContextProvider:onConfigurationChange: using codebase 
█ logEvent (telemetry disabled): CodyVSCodeExtension:Auth:failed VSCode {"opts":{"agent":true}}
█ telemetry-v2: recordEvent (no-op): cody.auth/failed: {"parameters":{"version":0},"timestamp":"2024-01-23T12:52:43.815Z"}
█ symf: downloaded symf to /root/.vscode-server/data/User/globalStorage/sourcegraph.cody-ai/symf/symf-v0.0.2-x86_64-linux.tmp
█ symf: extracted symf to /root/.vscode-server/data/User/globalStorage/sourcegraph.cody-ai/symf/symf-v0.0.2-x86_64-linux
█ symf: creating index /root/.vscode-server/data/User/globalStorage/sourcegraph.cody-ai/symf/indexroot/root/storage
█ logEvent (telemetry disabled): CodyVSCodeExtension:auth:simplifiedSignInGitHubClick VSCode {}
█ logEvent (telemetry disabled): CodyVSCodeExtension:auth:fromCallback VSCode {"properties":{"type":"callback","from":"web","success":false,"hasV2Event":true}}
█ telemetry-v2: recordEvent (no-op): cody.auth.fromCallback.web/succeeded: {"parameters":{"version":0,"metadata":[{"key":"success","value":0}]},"timestamp":"2024-01-23T12:53:06.036Z"}
█ Cody:publishConfig: configForWebview 
█ ContextProvider:onConfigurationChange: using codebase 
█ logEvent (telemetry disabled): CodyVSCodeExtension:Auth:failed VSCode {"opts":{"agent":true}}
█ telemetry-v2: recordEvent (no-op): cody.auth/failed: {"parameters":{"version":0},"timestamp":"2024-01-23T12:53:06.076Z"}
█ CodyCompletionProvider:notSignedIn: You are not signed in.
█ ContextProvider:onConfigurationChange: using codebase 
█ LocalEmbeddingsController: setAccessToken is dotcom
█ LocalEmbeddingsController: setAccessToken is dotcom
█ CodyCompletionProvider:notSignedIn: You are not signed in.

@jdorfman tried to help me on the Discord server and he suggested trying to log in via a Token, and using https://sourcegraph.com + a newly generated Token led me to the same error and same log output.

Expected behavior

Being able to use Cody on a remote session (VSCode running on a Linux VM and interface running on my local mac)

Additional context

No response

kalanchan commented 10 months ago

hey @Miaourt can you confirm your version #? We're currently on v1.2

rajkumarj-git commented 9 months ago

I'm facing the same issue Authentication failed. Please ensure Cody is enabled for sourcegraph.com and verify your email address if required. I'm running VS code in remote Machine which unable to authenticate.

Miaourt commented 9 months ago

Helo @kalanchan , sorry for late reply, can confirm it's still happening on v1.8.0

█ AuthProvider:init:lastEndpoint: https://sourcegraph.com/
█ LocalEmbeddingsController: constructor
█ ChatManager:constructor: init has local embeddings controller
█ ChatPanelsManager:constructor: init
█ SymfRunner: unsafeEnsureIndex file:///root/storage
█ symf: downloading symf from https://github.com/sourcegraph/symf/releases/download/v0.0.7/symf-x86_64-linux-musl.zip
█ Symf: downloading from URL https://github.com/sourcegraph/symf/releases/download/v0.0.7/symf-x86_64-linux-musl.zip
█ CommandsController:init: watchers created
█ CodyCompletionProvider:notSignedIn: You are not signed in.
█ symf: downloaded symf to /root/.vscode-server/data/User/globalStorage/sourcegraph.cody-ai/symf/symf-v0.0.7-x86_64-linux.tmp
█ symf: extracted symf to /root/.vscode-server/data/User/globalStorage/sourcegraph.cody-ai/symf/symf-v0.0.7-x86_64-linux
█ symf: creating index file:///root/.vscode-server/data/User/globalStorage/sourcegraph.cody-ai/symf/indexroot/root/storage
█ featureflag: refreshed
█ featureflag: refreshed
█ featureflag: refreshed
█ SidebarViewController:onDidReceiveMessage: initialized
█ Cody:publishConfig: configForWebview 
█ ContextProvider:onConfigurationChange: using codebase 
█ logEvent (telemetry disabled): CodyVSCodeExtension:Auth:failed 
█ telemetry-v2: recordEvent: cody.auth/failed 
█ logEvent (telemetry disabled): CodyVSCodeExtension:auth:simplifiedSignInGitHubClick 
█ simplified-onboarding: picked new onboarding experiment branch selection {"branch":0,"excludeFromExperiment":false,"setByTestingOverride":false}
█ logEvent (telemetry disabled): CodyVSCodeExtension:experiment:removeAuthenticationStep:exposed 
█ logEvent (telemetry disabled): CodyVSCodeExtension:auth:simplifiedSignInGitHubClick 
█ logEvent (telemetry disabled): CodyVSCodeExtension:experiment:removeAuthenticationStep:exposed 
█ logEvent (telemetry disabled): CodyVSCodeExtension:auth:simplifiedSignInGitHubClick 
█ logEvent (telemetry disabled): CodyVSCodeExtension:experiment:removeAuthenticationStep:exposed 
█ logEvent (telemetry disabled): CodyVSCodeExtension:auth:fromCallback 
█ telemetry-v2: recordEvent: cody.auth.fromCallback.web/succeeded 
█ Cody:publishConfig: configForWebview 
█ ContextProvider:onConfigurationChange: using codebase 
█ logEvent (telemetry disabled): CodyVSCodeExtension:Auth:failed 
█ telemetry-v2: recordEvent: cody.auth/failed 
█ ContextProvider:onConfigurationChange: using codebase 
█ LocalEmbeddingsController: setAccessToken is dotcom
█ LocalEmbeddingsController: setAccessToken is dotcom
█ CodyCompletionProvider:notSignedIn: You are not signed in.
█ CodyCompletionProvider:notSignedIn: You are not signed in.
█ featureflag: refreshed
█ featureflag: refreshed
Neurrone commented 8 months ago

I'm trying to use it on VS Code in WSL2, and am also getting the following error on trying to install the latest stable version of the extension:

Failed to download symf: Error: ENOENT: no such file or directory, open '/home/dickson/.vscode-server-insiders/data/User/globalStorage/sourcegraph.cody-ai/symf/symf-v0.0.7-x86_64-linux.tmp/symf-v0.0.7-x86_64-linux.zip'
Freedom-Blue commented 8 months ago

Version

1.85.2

Describe the bug

I'm working on a remote VSCode instance, on Linux from a MacOS host, and every time I try to log in (with the "sign in with *" buttons) I get greeted by a

Authentication failed. Please ensure Cody is enabled for sourcegraph.com and verify your email address if required.

Output logs:

█ CodyIgnore:updateCodyIgnoreCodespaceMap:codebase: gitlab.infra.online.net/storage/storage
█ CommandsController:fileWatcherInit: watchers created
█ AuthProvider:init:lastEndpoint: https://sourcegraph.com/
█ CodyIgnore:refresh:workspace: /root/storage
█ LocalEmbeddingsController: constructor
█ ChatManager:constructor: init has local embeddings controller
█ ChatPanelsManager:constructor: init
█ symf: downloading symf from https://github.com/sourcegraph/symf/releases/download/v0.0.2/symf-x86_64-linux-musl.zip
█ Symf: downloading from URL https://github.com/sourcegraph/symf/releases/download/v0.0.2/symf-x86_64-linux-musl.zip
█ CodyCompletionProvider:notSignedIn: You are not signed in.
█ SidebarViewController:onDidReceiveMessage: initialized
█ Cody:publishConfig: configForWebview 
█ ContextProvider:onConfigurationChange: using codebase 
█ logEvent (telemetry disabled): CodyVSCodeExtension:Auth:failed VSCode {"opts":{"agent":true}}
█ telemetry-v2: recordEvent (no-op): cody.auth/failed: {"parameters":{"version":0},"timestamp":"2024-01-23T12:52:43.815Z"}
█ symf: downloaded symf to /root/.vscode-server/data/User/globalStorage/sourcegraph.cody-ai/symf/symf-v0.0.2-x86_64-linux.tmp
█ symf: extracted symf to /root/.vscode-server/data/User/globalStorage/sourcegraph.cody-ai/symf/symf-v0.0.2-x86_64-linux
█ symf: creating index /root/.vscode-server/data/User/globalStorage/sourcegraph.cody-ai/symf/indexroot/root/storage
█ logEvent (telemetry disabled): CodyVSCodeExtension:auth:simplifiedSignInGitHubClick VSCode {}
█ logEvent (telemetry disabled): CodyVSCodeExtension:auth:fromCallback VSCode {"properties":{"type":"callback","from":"web","success":false,"hasV2Event":true}}
█ telemetry-v2: recordEvent (no-op): cody.auth.fromCallback.web/succeeded: {"parameters":{"version":0,"metadata":[{"key":"success","value":0}]},"timestamp":"2024-01-23T12:53:06.036Z"}
█ Cody:publishConfig: configForWebview 
█ ContextProvider:onConfigurationChange: using codebase 
█ logEvent (telemetry disabled): CodyVSCodeExtension:Auth:failed VSCode {"opts":{"agent":true}}
█ telemetry-v2: recordEvent (no-op): cody.auth/failed: {"parameters":{"version":0},"timestamp":"2024-01-23T12:53:06.076Z"}
█ CodyCompletionProvider:notSignedIn: You are not signed in.
█ ContextProvider:onConfigurationChange: using codebase 
█ LocalEmbeddingsController: setAccessToken is dotcom
█ LocalEmbeddingsController: setAccessToken is dotcom
█ CodyCompletionProvider:notSignedIn: You are not signed in.

@jdorfman tried to help me on the Discord server and he suggested trying to log in via a Token, and using https://sourcegraph.com + a newly generated Token led me to the same error and same log output.

Expected behavior

Being able to use Cody on a remote session (VSCode running on a Linux VM and interface running on my local mac)

Additional context

No response

I encountered the same Authentication failed issue in VSCode in WSL2.

jon-ccc commented 8 months ago

Me too VS Code remote linux

Cody AI Version: v1.10.0

VS Code v1.82.0

Authentication failed. Please ensure Cody is enabled for sourcegraph.com and verify your email address if required.
ltrottier-yelp commented 7 months ago

Same issue for me with VS Code remote linux.

Cody AI Version: v1.15.1713453164 (pre-release) VS Code: 1.88 Local mac version: 23.4.0 Darwin Remote linux version: 22.04.1-Ubuntu

Authentication failed. Please ensure Cody is enabled for sourcegraph.com and verify your email address if required.

Log

█ logEvent: CodyVSCodeExtension:auth:clickOtherSignInOptions 
█ AuthProvider:signinMenu: signin
█ logEvent: CodyVSCodeExtension:login:clicked 
█ telemetry-v2: recordEvent: cody.auth.login/clicked 
█ GraphQLTelemetryExporter: evaluated export mode: legacy
█ logEvent: CodyVSCodeExtension:auth:selectSigninMenu 
█ telemetry-v2: recordEvent: cody.auth.signin.menu/clicked 
█ logEvent: CodyVSCodeExtension:auth:fromToken 
█ telemetry-v2: recordEvent: cody.auth.signin.token/clicked 
█ Cody:publishConfig: configForWebview 
█ ContextProvider:onConfigurationChange: using codebase 
█ logEvent: CodyVSCodeExtension:Auth:failed 
█ telemetry-v2: recordEvent: cody.auth/failed 
█ featureflag: refreshed
█ CodyCompletionProvider:notSignedIn: You are not signed in.
ThePlenkov commented 6 months ago

I have same issue with our enterprise Cody.

Authentication failed. Please ensure Cody is enabled for sourcegraph.cooking.com and verify your email address if required.

in the log i can see this:

█ EventLogger: Error logging event Error: accessing Sourcegraph GraphQL API: FetchError: request to https://sourcegraph.cooking.com/.api/graphql?LogEventMutation failed, reason: Client network socket disconnected before secure TLS connection was established (https://sourcegraph.cooking.com/.api/graphql?LogEventMutation)
jdorfman commented 6 months ago

Hi, @ThePlenkov, a support engineer is/has reached out.

ltrottier-yelp commented 6 months ago

@jdorfman It's the same for our enterprise Cody too: sourcegraph.yelpcorp.com .

jdorfman commented 6 months ago

Thanks @ltrottier-yelp going to get you fixed up!

jdorfman commented 6 months ago

I just wanted to follow up with @ltrottier-yelp; I see that a support ticket is open on our side.

airamare01 commented 6 months ago

@ltrottier-yelp Could you please send us a quick email on support@sourcegraph.com for us to troubleshoot and help resolve this issue

ltrottier-yelp commented 6 months ago

Ok I will contact you support@sourcegraph.com

ltrottier-yelp commented 6 months ago

Turned out the company did not have a subscription, that's why I could not log.

airamare01 commented 6 months ago

Thanks for confirming @ltrottier-yelp

github-actions[bot] commented 4 months ago

This issue is marked as stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed automatically in 5 days.

diedgarsa commented 4 months ago

I am still observing this behaviour with Cody 1.26.7 in Code OSS running in a Docker container and self-hosted Sourcegraph Free (version 5.5.1337) instance with a single user.

The following command in Code OSS container executes successfully returning username of the user to whom the token belongs to, so the Sourcegraph instance appears to be accessible from the Code OSS container:

> curl \
  -H 'Authorization: token <token>' \
  -d '{"query":"query { currentUser { username } }"}' \
  https://sourcegraph.domain/.api/graphql
{"data":{"currentUser":{"username":"<username>"}}}

Cody is enabled on the self-hosted Sourcegraph instance and the email address is verified.

Nothing special in extension's output:

█ AuthProvider:signinMenu: signin
█ telemetry-v2: recordEvent: cody.auth.login/clicked 
█ telemetry-v2: recordEvent: cody.auth.signin.menu/clicked 
█ CodyCompletionProvider:notSignedIn: You are not signed in.
█ featureflag: refreshed
█ SimpleChatPanelProvider: updateViewConfig 
█ openctx: OpenCtx is enabled in Cody
█ openctx: Failed to load OpenCtx client: Error: command 'openctx.toggleEnable' already exists
█ telemetry-v2: recordEvent: cody.auth/failed 
█ featureflag: refreshed
█ CodyCompletionProvider:notSignedIn: You are not signed in.
█ openctx: OpenCtx is enabled in Cody
█ openctx: Failed to load OpenCtx client: Error: command 'openctx.toggleEnable' already exists
█ telemetry-v2: recordEvent: cody.auth/failed 
█ SimpleChatPanelProvider: updateViewConfig 
jdorfman commented 4 months ago

Thanks @diedgarsa

I will make sure the product team sees this in the weekly community feedback report (every Monday).

taqen commented 2 months ago

The issue persists with cody v1.34.3 (also pre-release 1.35) and vscode 1.93.1.

Authentication failed. Please ensure Cody is enabled and verify your email address if required.

PriNova commented 6 days ago

Hey @taqen

Does the issue still persist with the newest version of Cody or can it be closed?

Thank you

ThePlenkov commented 6 days ago

Not reproducible anymore for us

ThePlenkov commented 6 days ago

In my case it was caused by vs code proxy settings