Giter VIP home page Giter VIP logo

Comments (4)

mbrowne avatar mbrowne commented on May 30, 2024 1

@michaelmohamed Unfortunately it's not that simple... TLDR if you just want to get it working, then I recommend downgrading to an older version of the grpc handler for now; I think 0.93.2 might be the last version without the bug (which was introduced in #5420).

Explanation: the bug is happening because of a new feature that was added to include the grpc metadata in a .graphql file using a graphql directive, and then read the metadata from the .graphql file instead of directly from the grpc API. In theory, that will make it possible to publish the schema for grpc APIs to GraphQL Hive as explained in the docs, although not everyone needs that feature. The problem is that there's a bug in the way that the grpc metadata is saved in the .graphql file, meaning that graphql-mesh isn't always able to read it properly. Specifically, this seems to happen as soon as you're using a grpc API that has more than one protobuf package.

The WeakMap error is just a symptom of this issue, and my "fix" is just a better error message for it, because even when the underlying issue is fixed it would be good to have better error handling for that case. (My PR gives it this error message: "Protobuf metadata not found in the GraphQL schema or is corrupted. The gRPC handler only accepts GraphQL schema files generated using GraphQL Mesh".)

I was also trying to fix the underlying issue, but got too busy and it was also a bigger task than I first anticipated, because there seems to be an upstream issue in @graphql-tools/stitch or one of its dependencies. I'm not one of the maintainers of this repo so the code is unfamiliar to me...hopefully someone like @ardatan can take a look. Relevant details here and here.

from graphql-mesh.

mbrowne avatar mbrowne commented on May 30, 2024

I created a repo earlier with a reproduction of this issue. Steps to reproduce:

git clone [email protected]:mbrowne/graphql-mesh-bug-repro.git --single-branch --branch grpc-source-issue
cd graphql-mesh-bug-repro
yarn
yarn grpc:start

Then in another terminal window:

yarn mesh:start

I also already fixed this error in a fork of this repo:
https://github.com/ardatan/graphql-mesh/compare/master...mbrowne:graphql-mesh:grpc-sdl-fixes?expand=1

Unfortunately there is still a second issue that will likely be encountered by anyone who encounters this first issue, as I described at #5438, but I suppose it makes sense to start by getting a bug fix for this error merged.

from graphql-mesh.

michaelmohamed avatar michaelmohamed commented on May 30, 2024

@mbrowne is there a way to use your fix in my project by modifying my package.json?

How do we get these changes merged in?

from graphql-mesh.

kotyara85 avatar kotyara85 commented on May 30, 2024

Hey there, I faced the same issue >= 0.94.0 getting this error. < 0.94.0 dynamic vars are not working with :|

from graphql-mesh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.