graphql-mesh
graphql-mesh copied to clipboard
graphql-mesh with gRPC and openapi handlers + global transform results in cached variables
Issue workflow progress
Progress of the issue based on the Contributor Workflow
- [ ] 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox
Make sure to fork this template and run
yarn generate
in the terminal.Please make sure Mesh package versions under
package.json
matches yours.
- [ ] 2. A failing test has been provided
- [ ] 3. A local solution has been provided
- [ ] 4. A pull request is pending review
Describe the bug
To Reproduce Steps to reproduce the behavior: Repo to reproduce: https://github.com/casuallyhostile/graphql-mesh-repro-6614
You need to have grpc handler and openapi handler in one .meshrc
+ use global transform (mode: wrap)
e.g.
sources:
- name: Example
handler:
grpc:
endpoint: localhost:50051
metaData:
someKey: 'someValue'
connection_type: '{context.headers.connection}'
source: ./proto/service.proto
transforms:
- namingConvention:
fieldNames: camelCase
- name: StackExchange
handler:
openapi:
source: https://raw.githubusercontent.com/grokify/api-specs/master/stackexchange/stackexchange-api-v2.2_openapi-v3.0.yaml
transforms:
- namingConvention:
mode: wrap
typeNames: pascalCase
enumValues: upperCase
fieldNames: camelCase
fieldArgumentNames: camelCase
Create query with variables e.g.
query Test($genre: Genre) {
exampleGetMovies(input: {
movie: {
genre: $genre
}
}) {
result {
name
}
}
}
send 2 request, whith different variables e.g.
{ "genre": "ACTION" } # Request number one
{ "genre": "DRAMA" } # Request number two
Expected behavior
Second request should return "DRAMA" movies, but it returns "ACTION" movies. If you log request details you will see that second request got the cached values from first request
[0] {
[0] "movie": {
[0] "genre": 1
[0] }
[0] }
[0] called with MetaData: {"somekey":"someValue","connection_type":"keep-alive","user-agent":"grpc-node-js/1.10.1"}
[0] {
[0] "movie": {
[0] "genre": 1
[0] }
[0] }
[0] called with MetaData: {"somekey":"someValue","connection_type":"keep-alive","user-agent":"grpc-node-js/1.10.1"}
Environment:
- OS: MacOS Sonoma 14.12.1 / arm64 (but also reproduced in live env with Linux
alpine / amd64
) - NodeJS: v20.11.0
- "@graphql-mesh/cli": "0.89.0",
- "@graphql-mesh/grpc": "0.98.0",
- "@graphql-mesh/openapi": "^0.99.0",
- "@graphql-mesh/transform-naming-convention": "0.97.0",
Additional context
I have a suspicion that this issue could be related to https://github.com/ardatan/graphql-mesh/issues/6053