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 306 forks source link

bug: cannot sign in for VS Code extension #5979

Open jphaupt opened 1 month ago

jphaupt commented 1 month ago

Extension Information

Steps to Reproduce

  1. I try to sign in via any of the "Sign in with [...]" options
  2. I get redirected to Firefox, the token generates successfully, and says "Now opening VS Code..."
  3. it opens a blank page on Firefox, and in VSCode there is a stale "Signing in to Sourcegraphy" notification.

Since it seems to successfully generate a VS Code Extension access token, I tried to just copy/paste this into somewhere in the options, but I had no such luck.

Expected Behaviour

I can sign in and use the extension.

Logs

█ ChatsController:constructor init: █ telemetry-v2 recordEvent: cody.extension/savedLogin: █ telemetry-v2 recordEvent: cody.signInNotification/shown: █ telemetry-v2 recordEvent: cody.auth/disconnected: █ Autocomplete:createProvider You are not signed in.: █ ModelsService User model preferences changed: {"defaults":{},"selected":{}} █ GraphQLTelemetryExporter evaluated export mode:: 5.2.5+ █ GraphQLTelemetryExporter evaluated export mode:: 5.2.5+ █ GraphQLTelemetryExporter evaluated export mode:: 5.2.5+ █ GraphQLTelemetryExporter Error exporting telemetry events:: Error: Variable "value" has invalid value null. Expected type "JSONValue!", found null. █ UpstreamHealth Ping took 162ms (Gateway: 178ms): █ ChatController updateViewConfig: █ ChatController updateViewConfig: █ telemetry-v2 recordEvent: cody.webview.auth/simplifiedSignInGitLabClick: █ GraphQLTelemetryExporter Error exporting telemetry events:: Error: Variable "value" has invalid value null. Expected type "JSONValue!", found null. █ telemetry-v2 recordEvent: cody.webview.auth/simplifiedSignInGoogleClick: █ GraphQLTelemetryExporter Error exporting telemetry events:: Error: Variable "value" has invalid value null. Expected type "JSONValue!", found null. █ AuthProvider:signinMenu signin: █ telemetry-v2 recordEvent: cody.auth.login/clicked: █ GraphQLTelemetryExporter Error exporting telemetry events:: Error: Variable "value" has invalid value null. Expected type "JSONValue!", found null. █ telemetry-v2 recordEvent: cody.auth.signin.menu/clicked: █ GraphQLTelemetryExporter Error exporting telemetry events:: Error: Variable "value" has invalid value null. Expected type "JSONValue!", found null. █ auth Authenticating to https://sourcegraph.com/users/jphaupt-daaiv/settings/tokens/new/callback?requestFrom=CODY&tokenReceiverUrl=http%3A%2F%2F127.0.0.1%3A34617%2F2e0c2388c2fc4b503ce0396ad1552104.auth/openidconnect/login?prompt_auth=google&pc=sams&redirect=/user/settings/tokens/new/callback?requestFrom=CODY&tokenReceiverUrl=http%3A%2F%2F127.0.0.1%3A34617%2F2e0c2388c2fc4b503ce0396ad1552104/...: █ auth Failed to authenticate to https://sourcegraph.com/users/jphaupt-daaiv/settings/tokens/new/callback?requestFrom=CODY&tokenReceiverUrl=http%3A%2F%2F127.0.0.1%3A34617%2F2e0c2388c2fc4b503ce0396ad1552104.auth/openidconnect/login?prompt_auth=google&pc=sams&redirect=/user/settings/tokens/new/callback?requestFrom=CODY&tokenReceiverUrl=http%3A%2F%2F127.0.0.1%3A34617%2F2e0c2388c2fc4b503ce0396ad1552104/ due to invalid credentials or other endpoint error: accessing Sourcegraph HTTP API: Error: HTTP status code 405 (https://sourcegraph.com/users/jphaupt-daaiv/settings/tokens/new/callback?requestFrom=CODY&tokenReceiverUrl=http%3A%2F%2F127.0.0.1%3A34617%2F2e0c2388c2fc4b503ce0396ad1552104.auth/openidconnect/login?prompt_auth=google&pc=sams&redirect=/user/settings/tokens/new/callback?requestFrom=CODY&tokenReceiverUrl=http%3A%2F%2F127.0.0.1%3A34617%2F2e0c2388c2fc4b503ce0396ad1552104/.api/graphql?CurrentUser) █ telemetry-v2 recordEvent: cody.auth/failed: █ telemetry-v2 recordEvent: cody.auth.signin.token/clicked: █ GraphQLTelemetryExporter Error exporting telemetry events:: Error: Variable "value" has invalid value null. Expected type "JSONValue!", found null. █ GraphQLTelemetryExporter Error exporting telemetry events:: Error: Variable "value" has invalid value null. Expected type "JSONValue!", found null. █ telemetry-v2 recordEvent: cody.webview.auth/simplifiedSignInGitLabClick: █ GraphQLTelemetryExporter Error exporting telemetry events:: Error: Variable "value" has invalid value null. Expected type "JSONValue!", found null. █ telemetry-v2 recordEvent: cody.characters/flush:

linear[bot] commented 1 month ago

BUGS-575 bug: cannot sign in for VS Code extension

NateMarrocco commented 1 month ago

I have the exact same issue and have had it for months

PriNova commented 1 month ago

Are you using some kind of proxy service or VPN? @NateMarrocco @jphaupt

Zheka17 commented 1 month ago

Same issue here, with v1.40, VSCode 1.94.2 and 1.95.1, Debian 12 and Firefox...had it in the past as well...not under proxy, VPN or anything

Runtime Status Activation Activated by onLanguage event: 1ms

Uncaught Errors (2) Cannot write headers after they are sent to the client Cannot write headers after they are sent to the client

*Besides, good luck w reading v1.40 Release notes.

gabriel-tessier commented 2 weeks ago

I also have a sign in problem maybe the case is different or maybe related, if different I can open another issue.

About my context:

Extension Information

Cody Version: 1.42.0 (with auto update checked)
VS Code Version: 1.95.2
Extension Host: desktop
OS: Ubuntu LTS

Steps to Reproduce

I use Cody from a couple of months and so far there was no problems, yesterday I get logged out which already happen before, usually I click on the "Sign in with GitHub" and I can continue using it. But this time the login hang and I can no more connect. I saw in previous issue that disable enable the extension can resolve the problem. So I disable / enable , uninstall reinstall several times without success always get the same error in the console:

Here my logs from the console:

(https://sourcegraph.com/.api/graphql?RecordTelemetryEvents)
█ UpstreamHealth Ping took 285ms (Gateway: 406ms): "url=https://sourcegraph.com/healthz status=200 cf-ray=8e235a6858b75bfe-NRT"
█ ChatController updateViewConfig: {
  "uiKindIsWeb": false,
  "serverEndpoint": "https://sourcegraph.com/",
  "experimentalNoodle": false,
  "smartApply": true,
  "hasEditCapability": false,
  "webviewType": "sidebar",
  "multipleWebviewsEnabled": true,
  "internalDebugContext": false
}
█ ChatController updateViewConfig: {
  "uiKindIsWeb": false,
  "serverEndpoint": "https://sourcegraph.com/",
  "experimentalNoodle": false,
  "smartApply": true,
  "hasEditCapability": false,
  "webviewType": "sidebar",
  "multipleWebviewsEnabled": true,
  "internalDebugContext": false
}
█ telemetry-v2 recordEvent: cody.webview.auth/simplifiedSignInGitLabClick: {
  "parameters": {
    "version": 0,
    "metadata": [
      {
        "key": "tier"
      }
    ]
  },
  "timestamp": "2024-11-14T01:51:14.248Z"
}
█ GraphQLTelemetryExporter telemetry: failed to evaluate server version:: Error: accessing Sourcegraph HTTP API:  Error: HTTP status code 401: Invalid access token.
 (https://sourcegraph.com/.api/graphql?SiteProductVersion)
█ GraphQLTelemetryExporter Error exporting telemetry events:: Error: accessing Sourcegraph HTTP API:  Error: HTTP status code 401: Invalid access token.
 (https://sourcegraph.com/.api/graphql?RecordTelemetryEvents)

I revoked the token on gihub but without success, still stuck with the same error.

I don't use proxy or VPN, nothing change in my connection settings.

I also tested Sign In with Gitlab and get the same error.

Thanks for any help or fix.

gabriel-tessier commented 1 week ago

@gabriel-tessier I reply to myself, and maybe somebody else who will get a similar problem, my token expire which make sense with the error message: "status code 401: Invalid access token". After renewing it, Cody came back.