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

Incorrect GraphQL URL for github enterprise #1381

Closed
yulrizka opened this issue Oct 14, 2019 · 2 comments
Closed

Incorrect GraphQL URL for github enterprise #1381

yulrizka opened this issue Oct 14, 2019 · 2 comments
Labels
bug Issue identified by VS Code Team member as probable bug GitHubEnterprise

Comments

@yulrizka
Copy link
Contributor

  • 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

@RMacfarlane RMacfarlane added bug Issue identified by VS Code Team member as probable bug GitHubEnterprise labels Oct 14, 2019
@IllusionMH
Copy link
Contributor

IllusionMH commented Nov 1, 2019

Looks like #1382 resolved this issue but didn't use fixes #1381 to trigger auto-close. Or something else left?

@yulrizka
Copy link
Contributor Author

yulrizka commented Nov 1, 2019

It should, i might missed the '#' character in the PR title

@yulrizka yulrizka closed this as completed Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug GitHubEnterprise
Projects
None yet
Development

No branches or pull requests

3 participants