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

Send response errors only to coprocessor #5020

Open
smyrick opened this issue Apr 24, 2024 · 0 comments
Open

Send response errors only to coprocessor #5020

smyrick opened this issue Apr 24, 2024 · 0 comments

Comments

@smyrick
Copy link
Member

smyrick commented Apr 24, 2024

Is your feature request related to a problem? Please describe.**

Today I can configure the Router to send the response, which might have data or errors or extensions, to the coprocessor so that it can perform extra logic. However I can only choose to send the whole response body. If I am returning data back this body may be quite large and can cause performance issues or even errors inside my coprocessor trying to process large responses.

Instead I would like the ability to decide what parts of the GraphQL response I would like sent to a coprocessor.

Config today

coprocessor:
  url: http://127.0.0.1:8081
  supergraph:
    response:
      body: true

Describe the solution you'd like**

I would like the ability to decide what parts of the GraphQL response I would like sent to a coprocessor, so I can reduce the payload size.

It probably makes sense for this to be at the SupergraphResponse phase since that is where the Request is also in a parsed state vs the RouterResponse should be reserved for changing the entire response as it is about to be sent via HTTP back to the client

Note: We should include support for data, errors, and extensions separately

Possible new config:

coprocessor:
  url: http://127.0.0.1:8081
  supergraph:
    response:
      body_data: false
      body_errors: true
      body_extensions: true

Describe alternatives you've considered**

I could use Rhai scripts to process particular parts of the response

Additional context

Actually having a large payload can cause the coprocessor to fail which is a separate issue, so this feature request is one way in which we can solve that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants