lostintangent / spaces

Discover, share, and connect with developers across your favorite teams, classrooms and communities
https://aka.ms/vsls-spaces
MIT License
34 stars 3 forks source link

Error 500 when trying to join space with github login #120

Open edwardbrowncross opened 4 years ago

edwardbrowncross commented 4 years ago

When I try to join a space, all I see is an error. A toast in VS Code shows:

Command 'Live Share Spaces: Join Space' resulted in an error (Request failed with status code 500)

And the VS Code window log shows:

[2020-07-29 10:09:28.545] [renderer1] [error] Request failed with status code 500: Error: Request failed with status code 500
    at e.exports (c:\Users\Edward Browncross\.vscode\extensions\vsls-contrib.spaces-0.1.2\out\extension.js:1:50450)
    at e.exports (c:\Users\Edward Browncross\.vscode\extensions\vsls-contrib.spaces-0.1.2\out\extension.js:1:110355)
    at IncomingMessage.<anonymous> (c:\Users\Edward Browncross\.vscode\extensions\vsls-contrib.spaces-0.1.2\out\extension.js:8:5340)
    at IncomingMessage.emit (events.js:208:15)
    at endReadableNT (_stream_readable.js:1168:12)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)
edwardbrowncross commented 4 years ago

To investigate further, I started a local instance of the service, which gave this error:

Request: GET /v0/top_spaces
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in String.contains?/2
        (elixir 1.10.4) lib/string.ex:2216: String.contains?(nil, "@")
        (spaces 0.1.0) lib/spaces/auth.ex:454: LiveShareSpaces.Authentication.get_cascade_user_info/1
        (spaces 0.1.0) lib/spaces/auth.ex:479: LiveShareSpaces.Authentication.get_cascade_claims/1
        (spaces 0.1.0) lib/spaces/auth.ex:379: LiveShareSpaces.Authentication.set_user_claims/1
        (spaces 0.1.0) lib/spaces/http.ex:3: LiveShareSpaces.HTTP.plug_builder_call/2
        (plug_cowboy 2.1.0) lib/plug/cowboy/handler.ex:12: Plug.Cowboy.Handler.init/2
        (cowboy 2.6.3) /opt/app/deps/cowboy/src/cowboy_handler.erl:41: :cowboy_handler.execute/2
        (cowboy 2.6.3) /opt/app/deps/cowboy/src/cowboy_stream_h.erl:296: :cowboy_stream_h.execute/3

It appears that having a nil email address attached to your live share account causes an internal error. Unfortunately, nothing I do makes an email appear against my account in live share when logging in with gituhub. The steps I followed were:

  1. made my email address public on github
  2. deleted my live share account data using the link on this page
  3. recreated fresh live share account data by logging in through VS Code

my account still has no email address and spaces errors whenever I try to take any action

legomushroom commented 4 years ago

Hey @edwardbrowncross, pardon for the trouble, I'll investigate the issue shortly. AFAIR LiveShare requires an email on the profile to properly work, so at this point, it is not clear if that the issue on the Spaces side or not. Are you able to use LiveShare with this account?

legomushroom commented 4 years ago

Created the PR to fix this: https://github.com/vsls-contrib/spaces/pull/125 Please confirm that it solves your issue.

edwardbrowncross commented 4 years ago

Thanks for looking at this so quickly! Yes I am able to use LiveShare. My colleagues, who all have had the same experience as me, can also use it. We all have (null) as our email address though as this screenshot shows: image

In case it helps, my LiveShare user profile data looks like this:

{
    "initialProvider": "github",
    "status": "accepted",
    "registrationData": {},
    "providers": {
        "github": {
            "id": "35063432",
            "profileUrl": "https://github.com/edwardbrowncross",
            "displayName": "Edward Browncross",
            "username": "edwardbrowncross",
            "initials": "EB",
            "provider": "github",
            "photos": [
                {
                    "value": "https://avatars2.githubusercontent.com/u/35063432?v=4"
                }
            ],
            "emails": []
        }
    },
    "signupTime": 1596123945571,
    "telemetryId": "1b50d591-8e7b-49cf-bdb3-31521f063035",
    "id": "acaddbe1-d891-4548-ab43-28e7f138c568",
    "workspaces": []
}
legomushroom commented 4 years ago

Thanks, AFAIR LiveShare was dependent on the emails to be present at some point and looks like that have changed recently. Unfortunately, the LS Spaces client expects the email to be present in many places and that will need to be refactored. From my smoke testing yesterday, the PR above makes LS Spaces usable, but of course, I could not do the comprehensive testing tonight. cc @lostintangent