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

feat: Automatic schema reporting to Apollo Graph Manager #4084

Merged
merged 31 commits into from
May 19, 2020
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ad3073e
Initial Schema Reporting commit
May 14, 2020
764b1ce
Remove apollo link
May 12, 2020
67c57bf
Rename all schema hash and schema id to executable schema Id
May 12, 2020
de1523b
Remove override executable schema id generator
May 13, 2020
0413c20
Add and fix tests
May 14, 2020
75d9f94
Add simple caching
May 14, 2020
1ef5ec5
Add documentation
May 14, 2020
4b00bf2
Add schema id generator tests
May 14, 2020
968e94b
Increase delay time
May 14, 2020
6af8467
Fix equality
May 14, 2020
f094ebe
Address comments
May 15, 2020
465ebe5
Address comments
May 17, 2020
6ac44da
Cleanup
May 17, 2020
15fd0e6
Fix sha256 test
May 17, 2020
d9f0d8e
Fix plugin tests
May 17, 2020
977a89e
Prettier
May 18, 2020
f9751fe
Parially address comments
May 18, 2020
2551f93
Add error handling around http
May 18, 2020
490a02e
Adds test
May 18, 2020
ce2c8bf
Don't normalize GraphQL Schema in apollo-engine-reporting
May 18, 2020
a25a785
Apply suggestions from my own code review
abernix May 19, 2020
f08b1ca
Merge branch 'release-2.14.0' into jsegaran/schema_reporting
abernix May 19, 2020
5b8a766
Fix mistakes in my own GitHub suggestion.
abernix May 19, 2020
fd196fb
Separate JSON parsing failures from general `fetch` errors.
abernix May 19, 2020
4836f75
Tweak error message phrasing.
abernix May 19, 2020
3ddddd4
Apply specificity to the errors we are expecting to encounter.
abernix May 19, 2020
003b435
DRY up repeated error message for unexpected response shape.
abernix May 19, 2020
cb56ca2
Update "Engine" reference to "Apollo Graph Manager".
abernix May 19, 2020
e3b95e9
Fix my own markdown error.
abernix May 19, 2020
8598437
Just allow `any` type for the unexpected error msg.
abernix May 19, 2020
bf5379a
Don't dynamically import `crypto` to use `createHash`.
abernix May 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions packages/apollo-engine-reporting/src/schemaReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,24 @@ export class SchemaReporter {
headers: this.headers,
body: JSON.stringify(request),
});
const httpResponse = await fetch(httpRequest);
return httpResponse.json();
try {
const httpResponse = await fetch(httpRequest);
if (!httpResponse.ok) {
throw new Error("Failed to get a 200 response from graph manager");
abernix marked this conversation as resolved.
Show resolved Hide resolved
}

const json = await httpResponse.json();
return json;
abernix marked this conversation as resolved.
Show resolved Hide resolved
} catch (error) {
throw new Error(
[
'Unexpected http error from Apollo Graph Manager when reporting server info.',
'Did not receive a valid json response from Graph Manager',
abernix marked this conversation as resolved.
Show resolved Hide resolved
'If this continues to happen please reach out to [email protected]',
'Error:',
error
].join(' '),
);
}
}
}