Skip to content

Commit

Permalink
Fix regression caused by #3614 when using APQ with Graph Manager repo…
Browse files Browse the repository at this point in the history
…rting.

The fix in #3614 changed behavior which was not surfacing errors to the
extensions and request pipeline plugins when those errors occurred during
APQ negotiation.

However, it failed to consider - nor were there any tests - which ensured
that the `apollo-engine-reporting`'s mechanism didn't receive an error
earlier in the request pipeline than previously allowed.

This applies a fix which special-cases the APQ error in this case, and
avoids reporting it to Apollo Graph Manager (which is the same behavior as
before).
  • Loading branch information
abernix committed Dec 27, 2019
1 parent 59bca1c commit 247fe2d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/apollo-engine-reporting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"apollo-graphql": "^0.3.4",
"apollo-server-caching": "file:../apollo-server-caching",
"apollo-server-env": "file:../apollo-server-env",
"apollo-server-errors": "file:../apollo-server-errors",
"apollo-server-types": "file:../apollo-server-types",
"async-retry": "^1.2.1",
"graphql-extensions": "file:../graphql-extensions"
Expand Down
5 changes: 5 additions & 0 deletions packages/apollo-engine-reporting/src/treeBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
responsePathAsArray,
} from 'graphql';
import { Trace, google } from 'apollo-engine-reporting-protobuf';
import { PersistedQueryNotFoundError } from 'apollo-server-errors';

function internalError(message: string) {
return new Error(`[internal apollo-server error] ${message}`);
Expand Down Expand Up @@ -77,6 +78,10 @@ export class EngineReportingTreeBuilder {

public didEncounterErrors(errors: GraphQLError[]) {
errors.forEach(err => {
if (err instanceof PersistedQueryNotFoundError) {
return;
}

// This is an error from a federated service. We will already be reporting
// it in the nested Trace in the query plan.
//
Expand Down
1 change: 1 addition & 0 deletions packages/apollo-engine-reporting/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"exclude": ["**/__tests__", "**/__mocks__"],
"references": [
{ "path": "../graphql-extensions" },
{ "path": "../apollo-server-errors" },
{ "path": "../apollo-server-types" },
]
}

0 comments on commit 247fe2d

Please sign in to comment.