-
Notifications
You must be signed in to change notification settings - Fork 272
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
Add extensions.service
for all subgraph errors
#6191
Conversation
✅ Docs Preview ReadyNo new or changed pages found. |
This comment has been minimized.
This comment has been minimized.
CI performance tests
|
421c87c
to
bc618f9
Compare
3dddc1d
to
c3eb6f4
Compare
@@ -42,36 +42,47 @@ impl Plugin for IncludeSubgraphErrors { | |||
} | |||
|
|||
fn subgraph_service(&self, name: &str, service: subgraph::BoxService) -> subgraph::BoxService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include_subgraph_errors.rs
is the best place I could find to add this functionality:
- It's guaranteed that if
include_subgraph_errors: false
nothing will leak. So, we can't add this code later in the pipeline. - Also, we need to add it as late as possible to maximize the number of errors related to the subgraph handled by this code.
It maybe vulnerable to expose backend service name to public clients for some users. Is it possible to have error extensions allowlist/blacklist to control what properties should expose to clients? The allowlist/blacklist would also help if subgraph wants to expose non-vulnerable data to clients via errors. There maybe more than expected data they want to expose to client. In this case, a blacklist maybe more proper to have. We have few services whose clients depend on some data in the extensions. While they shouldn't, correcting it would take time. Meanwhile, their error message should be redacted. nit: I noticed |
@Samjin Errors exposed only if
Yes, it is consistent with existing subgraphs errors, for example: router/apollo-router/src/error.rs Lines 147 to 149 in 382fbe0
This PR just make this field consistently present for all errors related to particular subgraph. |
When subgraphs return a user-friendly errors that we want to propagate, then we need to set |
@yanns The service name propagation through subgraph errors was the default behavior in As a matter of fact, I'm watching this issue because migrating from |
Relate to proposal PR #6344 |
If
include_subgraph_errors
istrue
for a particular subgraph, all errors originating in this subgraph will have the subgraph's name exposed as aservice
extension.For example, if subgraph errors are enabled, like so:
Note: This option is enabled by default in the dev mode.
And this
products
subgraph returns an error, it will have aservice
extension:Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.
Exceptions
Note any exceptions here
Notes
Footnotes
It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. ↩
Configuration is an important part of many changes. Where applicable please try to document configuration examples. ↩
Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions. ↩