Skip to content

Incorrect GraphQL URL for github enterprise #1381

@yulrizka

Description

@yulrizka
  • Extension version: 0.12.0
  • VSCode Version: 1.40.0-insider
  • OS: Osx
  • Github Enterprise version: GitHub Enterprise Server 2.16.12

Steps to Reproduce:

  1. Login with github enterprise
  2. See the log message
[Info] https://github.[company].org/api/v3: GraphQL not supported (Network error: Response not successful: Received status code 404)

I think this is related to #947

This is caused by invalid graphQL URL for the enterprise version. The reason is that this function will fallback to /api/v3 for URL other than github.com

public static getApiPath(host: IHostConfiguration | vscode.Uri, path: string): string {
const hostUri: vscode.Uri = host instanceof vscode.Uri ? host : vscode.Uri.parse(host.host);
if (hostUri.authority === 'github.com') {
return path;
} else {
return `/api/v3${path}`;
}
}

But when constructing the ApolloClient, it append the base url with /graphql. which the URL now becomes /api/v3/graphql. That's why it returns 404.

}))).concat(createHttpLink({
uri: `${url}/graphql`,
// https://github.com/apollographql/apollo-link/issues/513
fetch: fetch as any
}));

Before fixing this, I couldn't create a pending PR review and comments. New comments was immediately posted as single comments (not as part of the pending review). I believe this is because it's using the REST API instead of the graphQL underneath.

How ever, once i use the correct graphQL URL. Loading Description page of PR no longer works. Got error with this

[Debug 130796s 117ms] PullRequestOverviewPanel> initialized without PR
[Debug 130796s 320ms] GitHubRepository> Fetch available merge methods - done
[Debug 130796s 328ms] GithubRepository> Unable to fetch PR: Error: GraphQL error: Field 'isDraft' doesn't exist on type 

Not sure why that is. But at least now I can use Draft PR functionalities

Metadata

Metadata

Assignees

No one assigned

    Labels

    GitHubEnterprisebugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions