-
Notifications
You must be signed in to change notification settings - Fork 720
Description
- 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:
- Login with github enterprise
- 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
vscode-pull-request-github/src/authentication/configuration.ts
Lines 18 to 25 in aae86fd
| 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.
vscode-pull-request-github/src/github/credentials.ts
Lines 316 to 320 in aae86fd
| }))).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