{"action":"closed","issue":{"url":"https://api.github.com/repos/Shopify/graphql-batch/issues/87","repository_url":"https://api.github.com/repos/Shopify/graphql-batch","labels_url":"https://api.github.com/repos/Shopify/graphql-batch/issues/87/labels{/name}","comments_url":"https://api.github.com/repos/Shopify/graphql-batch/issues/87/comments","events_url":"https://api.github.com/repos/Shopify/graphql-batch/issues/87/events","html_url":"https://github.com/Shopify/graphql-batch/issues/87","id":333456114,"node_id":"MDU6SXNzdWUzMzM0NTYxMTQ=","number":87,"title":"KeyError (key not found: 1)","user":{"login":"NicholasLYang","id":7357863,"node_id":"MDQ6VXNlcjczNTc4NjM=","avatar_url":"https://avatars3.githubusercontent.com/u/7357863?v=4","gravatar_id":"","url":"https://api.github.com/users/NicholasLYang","html_url":"https://github.com/NicholasLYang","followers_url":"https://api.github.com/users/NicholasLYang/followers","following_url":"https://api.github.com/users/NicholasLYang/following{/other_user}","gists_url":"https://api.github.com/users/NicholasLYang/gists{/gist_id}","starred_url":"https://api.github.com/users/NicholasLYang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicholasLYang/subscriptions","organizations_url":"https://api.github.com/users/NicholasLYang/orgs","repos_url":"https://api.github.com/users/NicholasLYang/repos","events_url":"https://api.github.com/users/NicholasLYang/events{/privacy}","received_events_url":"https://api.github.com/users/NicholasLYang/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-06-18T22:24:24Z","updated_at":"2018-06-19T15:39:48Z","closed_at":"2018-06-19T15:39:48Z","author_association":"NONE","body":"Hi, I'm getting the following error with my code:\r\n\r\n```\r\nKeyError (key not found: 1):\r\n  \r\napp/graphql/loaders/record_loader.rb:9:in `block in perform'\r\napp/graphql/loaders/record_loader.rb:9:in `perform'\r\napp/controllers/graphql_controller.rb:10:in `execute'\r\n```\r\nI can't quite figure out what I'm doing wrong, since the code is pretty much copied from the docs.\r\nrecord_loader.rb:\r\n\r\n```\r\nrequire 'graphql/batch'\r\n\r\nclass Loaders::RecordLoader < GraphQL::Batch::Loader\r\n  def initialize(model)\r\n    @model = model\r\n  end\r\n\r\n  def perform(ids)\r\n    @model.where(id: ids).each { |record| fulfill(record.id, record) }\r\n    ids.each { |id| fulfill(id, nil) unless fulfilled?(id) }\r\n  end\r\nend\r\n```\r\nand my query resolver:\r\n```\r\n  field :schoolById, Types::SchoolType do\r\n    description \"Get school by id\"\r\n    argument :id, types.ID\r\n    resolve -> (obj, args, context) {\r\n      Loaders::RecordLoader.for(School).load_many(args[\"id\"])\r\n    }\r\n  end\r\n```\r\nI've double checked my code, and `args[\"id\"]` is a single element, not an array, so #50 isn't the issue. Guessing by the error message, the issue is in fulfill, but I'm not sure how or why. It's probably something small or dumb that I'm missing haha.\r\n\r\nThanks for your time,\r\nNicholas"}}
{"actor":{"display_login":"NicholasLYang"}}