hasura / hasura/graphql-engine
Server: Type Name prefix and suffix are not removed when a mutation is forwarded to a remote service
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: I tested it with v2.7.0 and 2.8.4
### Environment
oss
### What is the current behavior?
When adding a suffix or prefix to type names of the remote schema the query is forwarded to the remote service with the suffix/prefix.
This causes Mutations to fail with some types of remote services if the suffixed Types are used as mutation inputs.
E.g. if the remote service is written with java and spring boot gql it tries to find a parser by using the type name on the input.
When the remote Service is a second Hasura the Input Type of the Mutation is ignored. I assume Hasura infers the type by the location of the variable in the query? At least it does not show up in the query log of the remote Hasura.
### What is the expected behavior?
Type Prefix and Suffix should be removed when the Mutation is forwarded to the remote service.
### How to reproduce the issue?
1. have a spring boot gql remote service(e.g. by following this tutorial https://medium.com/expedia-group-tech/creating-a-reactive-graphql-server-with-spring-boot-and-kotlin-54aca7316470)
2. add the spring boot service as a remote schema in Hasura and add a root field namespace and a type names suffix and/or prefix
3. Sent a mutation using the Suffixed type, e.g.:
```
mutation MyMutation($objects: [remote_table_insert_inputsuffix!] = {}) {
remote {
insert_remote_table(objects: $objects) {
affected_rows
}
}
}
```
as an alternative to the spring boot gql service, you can use any service that can log the exact query it receives to check that the suffix/prefix is not removed or try to intercept the request with Wireshark.
I tested it with a second Hasura as a remote service but it does not log the remote_table_insert_inputsuffix part of the example mutation above and it does not fail if it gets a request with a wrong type in the variable definition. I also tried 2 node.js mock graphql servers, but unfortunately, they ignore the type too. So I don't have an easy setup for you to reproduce the error, sorry.
### Any possible solutions?
Remove the suffix and prefix before sending the query to the remote service
### Can you identify the location in the source code where the problem exists?
no
### If the bug is confirmed, would you be willing to submit a PR?
no
### Keywords
suffix prefix
Contributor guide
Assessment
This issue has not been assessed yet.