apollo-engine-reporting: fix reporting errors from backends#3056
Conversation
6a09868 to
3b6af6a
Compare
5e6f2f4 to
c9945b7
Compare
|
I sent more details to Adam on slack as I'm in transit but:
|
|
Can you get a test for this PR? Look at the |
| } | ||
|
|
||
| return () => { | ||
| // It's possible that execution never started! |
There was a problem hiding this comment.
Does something here need to check this.enabled?
| path: ReadonlyArray<string | number> | undefined, | ||
| error: Trace.Error, | ||
| ) { | ||
| if (!this.startHrTime) { |
There was a problem hiding this comment.
Why are we still removing this?
| [rootResponsePath, this.rootNode], | ||
| ]); | ||
| private rewriteError?: (err: GraphQLError) => GraphQLError | null; | ||
| private consolePrefix = '[apollo-engine-reporting]'; |
There was a problem hiding this comment.
how is this helpful in errors? isn't the stack trace good enough?
There was a problem hiding this comment.
I'm a fan of this as it's a clearer indication that something is seriously fucked and it's not part of the implementing application.
There was a problem hiding this comment.
ok, but in that case maybe the message should literally say it's an internal bug in the library?
|
and pr desc needs an update |
080d65e to
ee4ec98
Compare
ee4ec98 to
2a31072
Compare
|
I rewrote this. |
2a31072 to
3d3898b
Compare
| // | ||
| // Note: format() is only called after executing an operation, and | ||
| // specifically isn't called for parse or validation errors. Parse and validation | ||
| // errors in a federated backend will get reported to the end user as a downstream |
There was a problem hiding this comment.
hm... can we track this as an issue for followup at least? Seems like it would be useful to know if the query planner is sending sub-operations that fail validation :)
| import { Trace, google } from 'apollo-engine-reporting-protobuf'; | ||
|
|
||
| function internalError(message: string) { | ||
| return new Error(`[internal apollo-server error] ${message}`); |
There was a problem hiding this comment.
nit: I do think apollo-engine-reporting is probably more appropriate, or internal apollo metrics reporting if we want to avoid the term engine.
There was a problem hiding this comment.
I mean that's in the stack trace?
The extension stack executionDidEnd method gets called before didEncounterErrors for GraphQL errors returned from execution (although confusingly the plugin executionDidEnd method gets called after), which caused the assertion that nothing gets added to the EngineReportingTreeBuilder after stopTiming to fail. Fix by moving stopTiming to the last possible moment: format(). Actually test error reporting, including both kinds of rewriting. Add a comment noting that backend parse and validation errors don't get reported. Fixes #3052.
3d3898b to
1fd58cc
Compare
The extension stack executionDidEnd method gets called before didEncounterErrors
for GraphQL errors returned from execution (although confusingly the plugin
executionDidEnd method gets called after), which caused the assertion that
nothing gets added to the EngineReportingTreeBuilder after stopTiming to
fail. Fix by moving stopTiming to the last possible moment: format().
Actually test error reporting, including both kinds of rewriting.
Add a comment noting that backend parse and validation errors don't get
reported.
Fixes #3052.