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

request.body.operaton_name is empty even query contain named operation #5014

Open
IvanGoncharov opened this issue Apr 24, 2024 · 0 comments · May be fixed by #5008
Open

request.body.operaton_name is empty even query contain named operation #5014

IvanGoncharov opened this issue Apr 24, 2024 · 0 comments · May be fixed by #5008
Assignees

Comments

@IvanGoncharov
Copy link
Member

Describe the bug

To Reproduce
Steps to reproduce the behavior:

  1. Setup rhai script:
fn process_request(request) {
  print(`${request.body.operation_name}`);
}

fn supergraph_service(service) {
  // Rhai convention for creating a function pointer
  const request_callback = Fn("process_request"); 
  
  service.map_request(request_callback);
}

  1. Send request without operationName:
curl -H 'Content-Type: application/json' http://127.0.0.1:4000/ -d '{ "query": "query OperationName { me { id } }" }'
  1. See that the rhai script printed an empty operation name.

Expected behavior
Expected request.body.operation_name to be OperationName

Additional context
Currently, request.body.operation_name is a direct copy of operationName from the client request.
But this behavior is very confusing to customers who expect it to have an operation name, if any, extracted from the query.

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

Successfully merging a pull request may close this issue.

1 participant