question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FailedToConvertPartOfTheQuery: Failed to convert to graphql query: i

See original GitHub issue

Describe the bug When executing a Query or Mutation with variables, the project won’t compile with the error FailedToConvertPartOfTheQuery

How to Reproduce

Create new project with the graphql schema url: https://api-mumbai.lens.dev/graphql/:

Project init:

dotnet new console -o QLClient
cd QLClient
dotnet new tool-manifest 
dotnet tool install ZeroQL.CLI
dotnet add package ZeroQL 
dotnet zeroql schema pull -u https://api-mumbai.lens.dev/graphql/
dotnet zeroql generate --schema ./schema.graphql --namespace TestServer.Client --client-name TestServerGraphQLClient --output Generated/GraphQL.g.cs

Program.cs:

using TestServer.Client;

var httpClient = new HttpClient();
httpClient.BaseAddress = new Uri("https://api-mumbai.lens.dev/graphql/");
var client = new TestServerGraphQLClient(httpClient);

var request = new ChallengeRequest { Address = "0x1c2eAdbB291709D3252610C431A6Ee355191E545" };
client.Query(request, static (i, o) => o.Challenge(i, result => new { result.Text }));

Expected behavior The project should compile and run the queries.

Screenshots image

Environment (please complete the following information):

  • IDE: VS for Windows AND VS for Mac (reporoduced on both)
  • .Net Version: 6.0

Issue Analytics

  • State:closed
  • Created 4 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
byme8commented, May 11, 2023

There is no need for second static.

var request = new {
    Input = new SingleProfileQueryRequest { ProfileId = "0x0185" },
    Sources = new Sources[] { new Sources("lenster") }
};

var stats = client.Query(request,
    static (i, o)
        => o.Profile(i.Input, result
            => new { r = result.Stats(outStats
                => new 
                {
                    Id = outStats.Id,
                    TotalCollects = outStats.TotalCollects,
                    TotalCollectsValue = outStats.CommentsTotal(i.Sources),
                })}));

1reaction
byme8commented, May 10, 2023

I think I have to add a custom error message for such cases to avoid future misunderstanding,

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error handling - Apollo GraphQL Docs
A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ. OPERATION_RESOLUTION_FAILURE. The...
Read more >
I have a graphQL query and wanted to convert it ...
The query shows issues with @Key as Your GraphQL Schema is using "@key" directive from an older version of the GraphQL Transformer ....
Read more >
Cannot convert graphql.common.request.graphqlrequest to ...
Hi, I am new to GraphQL and I have created the below API to query some data from the internal webpage. I am...
Read more >
Full Stack Error Handling with GraphQL and Apollo
If networkError is present in your response, it means your entire query was rejected, and therefore no data was returned. For example, the ......
Read more >
Error trying to resolve a query field · Issue #239
Hi, I started using graphiQL + graphql-dotnet with mysql database and EF. I add a new query object "ruoli" in to the container, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found