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

graphql-mesh with gRPC and openapi handlers + global transform results in cached variables #6614

Open
4 tasks
casuallyhostile opened this issue Feb 29, 2024 · 1 comment

Comments

@casuallyhostile
Copy link

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

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

Screenshot 2024-02-29 at 15 29 05
[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

@casuallyhostile
Copy link
Author

I have a suspicion that this issue could be related to #6053

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

No branches or pull requests

1 participant