We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
Error paths and locations are duplicated with duplicate queries that error lazily.
I provided a simple script to reproduce this issue. It uses a simple single field schema with a dataloader that always resolves to an error:
require 'graphql' require 'json' class ItemLoader < GraphQL::Dataloader::Source def fetch(keys) keys.map { |key| GraphQL::ExecutionError.new("Error for #{key}") } end end class QueryType < GraphQL::Schema::Object field :item, String do argument :key, String end def item(key:) dataloader.with(ItemLoader).load(key) end end class Schema < GraphQL::Schema query QueryType use GraphQL::Dataloader end query = <<-GRAPHQL query { query0: item(key: "a") query1: item(key: "a") } GRAPHQL result = Schema.execute(query) puts JSON.pretty_generate(result.to_h)
When running the above, I would expect to see the following:
{ "errors": [ { "message": "Error for a", "locations": [ { "line": 2, "column": 5 } ], "path": [ "query0" ] }, { "message": "Error for a", "locations": [ { "line": 3, "column": 5 } ], "path": [ "query1" ] } ], "data": { "query0": null, "query1": null } }
but instead, I'm seeing this:
{ "errors": [ { "message": "Error for a", "locations": [ { "line": 2, "column": 5 } ], "path": [ "query0" ] }, { "message": "Error for a", "locations": [ { "line": 2, "column": 5 } ], "path": [ "query0" ] } ], "data": { "query0": null, "query1": null } }
Versions
graphql version: 2.3.9
graphql
GraphQL schema
class ItemLoader < GraphQL::Dataloader::Source def fetch(keys) keys.map { |key| GraphQL::ExecutionError.new("Error for #{key}") } end end class QueryType < GraphQL::Schema::Object field :item, String do argument :key, String end def item(key:) dataloader.with(ItemLoader).load(key) end end class Schema < GraphQL::Schema query QueryType use GraphQL::Dataloader end
GraphQL query
Example GraphQL query and response (if query execution is involved)
query { query0: item(key: "a") query1: item(key: "a") }
Steps to reproduce
The script I provided at the beginning of this issue is all you need
Expected behavior
I expect error paths and locations for all fields to be unique per field
Actual behavior
I'm seeing error paths and locations for duplicate queries/fields duplicated, instead of being unique
The text was updated successfully, but these errors were encountered:
Merge pull request #5025 from juanrgon/issue-5020--2.1.x-fix
29f83a7
Backport fix to Issue #5020 to 2.1.x
Merge pull request #5026 from juanrgon/issue-5020--2.2.x-fix
ae16068
Backport fix to Issue #5020 to 2.2.x
Successfully merging a pull request may close this issue.
Describe the bug
Error paths and locations are duplicated with duplicate queries that error lazily.
I provided a simple script to reproduce this issue. It uses a simple single field schema with a dataloader that always resolves to an error:
When running the above, I would expect to see the following:
but instead, I'm seeing this:
Versions
graphql
version: 2.3.9GraphQL schema
GraphQL query
Example GraphQL query and response (if query execution is involved)
Steps to reproduce
The script I provided at the beginning of this issue is all you need
Expected behavior
I expect error paths and locations for all fields to be unique per field
Actual behavior
I'm seeing error paths and locations for duplicate queries/fields duplicated, instead of being unique
The text was updated successfully, but these errors were encountered: