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

Mesh prefixes variable names #5097

Open
4 tasks
Warxcell opened this issue Feb 1, 2023 · 3 comments
Open
4 tasks

Mesh prefixes variable names #5097

Warxcell opened this issue Feb 1, 2023 · 3 comments

Comments

@Warxcell
Copy link
Contributor

Warxcell commented Feb 1, 2023

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

image

graphql-mesh prefixes some of variables with _v1_ which makes it confusing, the client ends-up in non-sense error: "the variables which doesn't exists have wrong value.

To Reproduce Steps to reproduce the behavior:

Tried to reproduce it on sandbox, but couldn't
Expected behavior

Variables to stay as they are.

Environment:

  • OS: linuux
    "@graphql-mesh/graphql@^0.33": version "0.33.8"
  • NodeJS: v19.4.0

Additional context

I was trying to find where this prefix comes from without any success.

Leaving single source fixes the issue.

@ardatan
Copy link
Owner

ardatan commented Feb 1, 2023

I don't think this can be changed because Mesh doesn't forward queries from the gateway to the services as-is. It generates a new query based on the gateway's request. It uses prefixes due to some internal reasons.
But if you think this causes an issue, please share a reproduction on CodeSandbox or StackBlitz.

@Warxcell
Copy link
Contributor Author

Warxcell commented Feb 1, 2023

Funny thing is that it doesn't always happens. Will play tomorrow again with sandbox to try to reproduce it.

Locally when there are 2 sources - it happens, but in sandbox it doesn't happens. Can you point me to the code which internally generates the new docs so I can put breakpoints there? Thanks.

@Warxcell
Copy link
Contributor Author

I was able to reproduce it here: https://github.com/Warxcell/graphql-mesh-renaming-vars

with following query

query t($where: AssetFilter!) {
  assetCollection(where: $where) {
    total
    items {
      title
    }
  }
}

vars:

{
  "where": {
    "sys": {
      "publishedAt": "dsada"
    }
  }
}

result:

image

This was referenced Apr 30, 2024
This was referenced May 7, 2024
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

2 participants